Warning #186: Pointless comparison of unsigned integer with zero

An unsigned variable will never be less than 0

Example #1: from Linux-2.6-rc3 file net/ipv6/raw.c

    643 static int rawv6_sendmsg(struct kiocb *iocb, struct sock *sk,
    644                    struct msghdr *msg, size_t len)
    645 {

    646 - 660 ...       

    661
    662         /* Rough check on arithmetic overflow,
    663            better check is made in ip6_build_xmit
    664          */
    665         if (len < 0)
    666                 return -EMSGSIZE;

How to resolve:

Requires inspection. Depending on context can be difficult to fix.

SourceForge.net Logo