public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
To: kbuild test robot <fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>,
	kbuild-all-JC7UmRfGjtg@public.gmane.org,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: drivers/infiniband/core/uverbs_main.c:683:17: sparse: Using plain integer as NULL pointer
Date: Tue, 19 Nov 2013 14:13:01 +0100	[thread overview]
Message-ID: <1384866781.20207.7.camel@localhost.localdomain> (raw)
In-Reply-To: <528b3984.SVGs20ZWpcuR/Jls%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

       reply	other threads:[~2013-11-19 13:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <528b3984.SVGs20ZWpcuR/Jls%fengguang.wu@intel.com>
     [not found] ` <528b3984.SVGs20ZWpcuR/Jls%fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2013-11-19 13:13   ` Yann Droneaud [this message]
     [not found]   ` <cover.1384869925.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2013-11-19 14:22     ` [PATCH for-next 1/2] IB/core: const'ify inbuf in struct ib_udata Yann Droneaud
2013-11-19 14:22     ` [PATCH for-next 2/2] IB/uverbs: remove implicit cast in INIT_UDATA() Yann Droneaud
     [not found] ` <1384866781.20207.7.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2013-11-19 14:22   ` [PATCH for-next 0/2] Fix "drivers/infiniband/core/uverbs_main.c:683:17: sparse: Using plain integer as NULL pointer" warning Yann Droneaud

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=1384866781.20207.7.camel@localhost.localdomain \
    --to=ydroneaud-rly5vtjfyj3qt0dzr+alfa@public.gmane.org \
    --cc=fengguang.wu-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=kbuild-all-JC7UmRfGjtg@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.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