{"action":"created","issue":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/5298","repository_url":"https://api.github.com/repos/RIOT-OS/RIOT","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/5298/labels{/name}","comments_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/5298/comments","events_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/5298/events","html_url":"https://github.com/RIOT-OS/RIOT/pull/5298","id":147643075,"number":5298,"title":"cib: check (write > read) explicitly","user":{"login":"cgundogan","id":739129,"avatar_url":"https://avatars.githubusercontent.com/u/739129?v=3","gravatar_id":"","url":"https://api.github.com/users/cgundogan","html_url":"https://github.com/cgundogan","followers_url":"https://api.github.com/users/cgundogan/followers","following_url":"https://api.github.com/users/cgundogan/following{/other_user}","gists_url":"https://api.github.com/users/cgundogan/gists{/gist_id}","starred_url":"https://api.github.com/users/cgundogan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cgundogan/subscriptions","organizations_url":"https://api.github.com/users/cgundogan/orgs","repos_url":"https://api.github.com/users/cgundogan/repos","events_url":"https://api.github.com/users/cgundogan/events{/privacy}","received_events_url":"https://api.github.com/users/cgundogan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/core","name":"core","color":"0052cc"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/enhancement","name":"enhancement","color":"f17070"},{"url":"https://api.github.com/repos/RIOT-OS/RIOT/labels/Ready%20for%20CI%20build","name":"Ready for CI build","color":"bfdadc"}],"state":"open","locked":false,"assignee":{"login":"kaspar030","id":4679640,"avatar_url":"https://avatars.githubusercontent.com/u/4679640?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspar030","html_url":"https://github.com/kaspar030","followers_url":"https://api.github.com/users/kaspar030/followers","following_url":"https://api.github.com/users/kaspar030/following{/other_user}","gists_url":"https://api.github.com/users/kaspar030/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspar030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspar030/subscriptions","organizations_url":"https://api.github.com/users/kaspar030/orgs","repos_url":"https://api.github.com/users/kaspar030/repos","events_url":"https://api.github.com/users/kaspar030/events{/privacy}","received_events_url":"https://api.github.com/users/kaspar030/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/14","html_url":"https://github.com/RIOT-OS/RIOT/milestones/Release%202016.07","labels_url":"https://api.github.com/repos/RIOT-OS/RIOT/milestones/14/labels","id":1657251,"number":14,"title":"Release 2016.07","description":"","creator":{"login":"authmillenon","id":675644,"avatar_url":"https://avatars.githubusercontent.com/u/675644?v=3","gravatar_id":"","url":"https://api.github.com/users/authmillenon","html_url":"https://github.com/authmillenon","followers_url":"https://api.github.com/users/authmillenon/followers","following_url":"https://api.github.com/users/authmillenon/following{/other_user}","gists_url":"https://api.github.com/users/authmillenon/gists{/gist_id}","starred_url":"https://api.github.com/users/authmillenon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/authmillenon/subscriptions","organizations_url":"https://api.github.com/users/authmillenon/orgs","repos_url":"https://api.github.com/users/authmillenon/repos","events_url":"https://api.github.com/users/authmillenon/events{/privacy}","received_events_url":"https://api.github.com/users/authmillenon/received_events","type":"User","site_admin":false},"open_issues":170,"closed_issues":8,"state":"open","created_at":"2016-03-21T13:28:08Z","updated_at":"2016-04-12T08:17:59Z","due_on":"2016-07-14T22:00:00Z","closed_at":null},"comments":4,"created_at":"2016-04-12T06:10:38Z","updated_at":"2016-04-12T08:39:38Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/pulls/5298","html_url":"https://github.com/RIOT-OS/RIOT/pull/5298","diff_url":"https://github.com/RIOT-OS/RIOT/pull/5298.diff","patch_url":"https://github.com/RIOT-OS/RIOT/pull/5298.patch"},"body":"AFAIC, in the current implementation of `cib_get`, the copmarison of the unsigned value `avail` against `0` makes no sense at all. It will never go below `0`. This should report false positives when the `read_count` is greater than the `write_count`, but I did not test that.\r\n\r\nThis PR checks directly `write_count > read_count`.\r\n\r\n*EDIT:* The code is structured the way that `read_count` can never go below `write_count`, so the original check `avail > 0` is still correct, but IMO less readable then `avail != 0` or `write_count > read_count`.\r\n\r\nI will keep this PR open for now until it gets (N)ACKed."},"comment":{"url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/comments/208787195","html_url":"https://github.com/RIOT-OS/RIOT/pull/5298#issuecomment-208787195","issue_url":"https://api.github.com/repos/RIOT-OS/RIOT/issues/5298","id":208787195,"user":{"login":"kaspar030","id":4679640,"avatar_url":"https://avatars.githubusercontent.com/u/4679640?v=3","gravatar_id":"","url":"https://api.github.com/users/kaspar030","html_url":"https://github.com/kaspar030","followers_url":"https://api.github.com/users/kaspar030/followers","following_url":"https://api.github.com/users/kaspar030/following{/other_user}","gists_url":"https://api.github.com/users/kaspar030/gists{/gist_id}","starred_url":"https://api.github.com/users/kaspar030/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaspar030/subscriptions","organizations_url":"https://api.github.com/users/kaspar030/orgs","repos_url":"https://api.github.com/users/kaspar030/repos","events_url":"https://api.github.com/users/kaspar030/events{/privacy}","received_events_url":"https://api.github.com/users/kaspar030/received_events","type":"User","site_admin":false},"created_at":"2016-04-12T08:39:38Z","updated_at":"2016-04-12T08:39:38Z","body":"yup! ACK."}}