From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: [bug report] A Sample of using socket cookie and uid for traffic monitoring
Date: Tue, 04 Apr 2017 09:13:11 +0000 [thread overview]
Message-ID: <20170404091310.GA4061@mwanda> (raw)
Hello Chenbo Feng,
The patch 51570a5ab2b7: "A Sample of using socket cookie and uid for
traffic monitoring" from Mar 22, 2017, leads to the following static
checker warning:
./samples/bpf/cookie_uid_helper_example.c:185 print_table()
warn: unsigned 'res' is never less than zero.
samples/bpf/cookie_uid_helper_example.c
176 static void print_table(void)
177 {
178 struct stats curEntry;
179 uint32_t curN = UINT32_MAX;
180 uint32_t nextN, res;
^^^
Unsigned.
181
182 while (bpf_map_get_next_key(map_fd, &curN, &nextN) > -1) {
183 curN = nextN;
184 res = bpf_map_lookup_elem(map_fd, &curN, &curEntry);
185 if (res < 0) {
^^^^^^^
Not possible.
186 error(1, errno, "fail to get entry value of Key: %u\n",
187 curN);
188 } else {
189 printf("cookie: %u, uid: 0x%x, Packet Count: %lu,"
190 " Bytes Count: %lu\n", curN, curEntry.uid,
191 curEntry.packets, curEntry.bytes);
192 }
193 }
194 }
regards,
dan carpenter
reply other threads:[~2017-04-04 9:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170404091310.GA4061@mwanda \
--to=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox