Thread (6 messages) 6 messages, 4 authors, 2018-08-01

Re: [PATCH 0/3] cast sizeof to int for comparison

From: Julia Lawall <hidden>
Date: 2018-07-01 18:52:18
Also in: kernel-janitors, linux-media, lkml


On Sun, 1 Jul 2018, Joe Perches wrote:
On Sun, 2018-07-01 at 19:32 +0200, Julia Lawall wrote:
quoted
Comparing an int to a size, which is unsigned, causes the int to become
unsigned, giving the wrong result.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)
Great, thanks.

But what about the ones in net/smc like:
quoted
net/smc/smc_clc.c:

        len = kernel_sendmsg(smc->clcsock, &msg, &vec, 1,
                             sizeof(struct smc_clc_msg_decline));
        if (len < sizeof(struct smc_clc_msg_decline))
Are those detected by the semantic match and ignored?
I wasn't sure how to justify that kernel_sendmsg returns a negative value.
If it is the case, I can send the patch.  I only found this in one file,
but there were multiple occurrences.

julia
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help