Hi, 

Just received this warning[1] report:

Le mardi 19 novembre 2013 à 18:12 +0800, kbuild test robot a écrit :
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> master
> head:   801a76050bcf8d4e500eb8d048ff6265f37a61c8
> commit: f21519b23c1b6fa25366be4114ccf7fcf1c190f9 IB/core: extended command: 
> an improved infrastructure for uverbs commands
> date:   2 days ago
> reproduce: make C=1 CF=-D__CHECK_ENDIAN__
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> drivers/infiniband/core/uverbs_main.c:683:17: sparse: Using plain integer 
> >> as NULL pointer
> >> drivers/infiniband/core/uverbs_main.c:689:17: sparse: Using plain integer 
> >> as NULL pointer
> 
> vim +683 drivers/infiniband/core/uverbs_main.c
> 
>    677                                        return -EINVAL;
>    678                        } else {
>    679                                if (hdr.out_words || 
> ex_hdr.provider_out_words)
>    680                                        return -EINVAL;
>    681                        }
>    682        
>  > 683                        INIT_UDATA(&ucore,
>    684                                   (hdr.in_words) ? buf : 0,
>    685                                   (unsigned long)ex_hdr.response,
>    686                                   hdr.in_words * 8,
>    687                                   hdr.out_words * 8);
>    688        
>  > 689                        INIT_UDATA(&uhw,
>    690                                   (ex_hdr.provider_in_words) ? buf + 
> ucore.inlen : 0,
>    691                                   (ex_hdr.provider_out_words) ? 
> (unsigned long)ex_hdr.response + ucore.outlen : 0,
>    692                                   ex_hdr.provider_in_words * 8,
> 

This warning is not reported by compiler (gcc) since an explicit cast is
present in INIT_UDATA(): see drivers/infiniband/core/uverbs.h[2]:

#define INIT_UDATA(udata, ibuf, obuf, ilen, olen)               \
        do {                                                    \
                (udata)->inbuf  = (void __user *) (ibuf);       \
                (udata)->outbuf = (void __user *) (obuf);       \
                (udata)->inlen  = (ilen);                       \
                (udata)->outlen = (olen);                       \
        } while (0)


I'm going to submit a patch to fix the sparse warning by removing
implicit cast, adding explicit casts where appropriate and replace
0 by NULL in uverbs_main.c

[1] kbuild-all archives
https://lists.01.org/pipermail/kbuild-all/2013-November/002120.html

[2] uverbs.h
http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/core/uverbs.h#n50

> ---
> 0-DAY kernel build testing backend              Open Source Technology Center
> http://lists.01.org/mailman/listinfo/kbuild                 Intel Corporation

-- 
Yann Droneaud
OPTEYA


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to