Re: [PATCH net] packet: bail out of packet_snd() if L2 header creation fails

From: Christoph Jaeger
Date: Sun Jan 11 2015 - 14:34:30 EST


On Sun, Jan 11, 2015 at 10:52:25AM -0800, Joe Perches wrote:
> On Sun, 2015-01-11 at 13:01 -0500, Christoph Jaeger wrote:
> > Due to a misplaced parenthesis, the expression
> >
> > (unlikely(offset) < 0),
> >
> > which expands to
> >
> > (__builtin_expect(!!(offset), 0) < 0),
>
> Here's another one:
>
> drivers/platform/goldfish/goldfish_pipe.c:285: if (unlikely(bufflen) == 0)

Well, the conditional statement works as intended. Of course, the branch
prediction doesn't.

Coccinelle should be able to check for this kind of likely()/unlikely() usage,
shouldn't it?

~Christoph
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/