public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@openvz.org>
To: kernel-janitors@vger.kernel.org
Subject: Re: [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base ty
Date: Wed, 26 Sep 2012 17:08:40 +0000	[thread overview]
Message-ID: <20120926170840.GC20086@moon> (raw)
In-Reply-To: <20120926155910.GA14447@localhost>

On Wed, Sep 26, 2012 at 11:59:10PM +0800, Fengguang Wu wrote:
> Hi Cyrill,
> 
> FYI, there are new sparse warnings show up in
> 
> tree:   git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git akpm
> head:   dad0019944369f58c193c1991c39ffda7ff584d2
> commit: c9eeef146c554f8ddcdf5916fb93621f0579e2f8 [26/413] prctl: use access_ok() instead of TASK_SIZE in prctl_set_mm()
> 
>   kernel/sys.c:1048:38: sparse: incorrect type in argument 2 (different modifiers)

Thanks Fengguang!

This patch should calm the warning down (I wonder why gcc has not
spot anything, otoh on asm level it's plain long as far as i can
tell).
---
From: Cyrill Gorcunov <gorcunov@openvz.org>
Subject: prctl: prctl_set_mm - Cast type of @addr

The sparse tool warns about type casting

 >   kernel/sys.c:1048:38: sparse: incorrect type in argument 2 (different modifiers)

Fix it with explicit type convention.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 kernel/sys.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/kernel/sys.c
=================================--- linux-2.6.git.orig/kernel/sys.c
+++ linux-2.6.git/kernel/sys.c
@@ -1865,7 +1865,7 @@ static int prctl_set_mm(int opt, unsigne
 	if (opt = PR_SET_MM_EXE_FILE)
 		return prctl_set_mm_exe_file(mm, (unsigned int)addr);
 
-	if (!access_ok(VERIFY_READ, addr, sizeof(addr)) || addr < mmap_min_addr)
+	if (!access_ok(VERIFY_READ, (void *)addr, sizeof(addr)) || addr < mmap_min_addr)
 		return -EINVAL;
 
 	error = -EINVAL;

  reply	other threads:[~2012-09-26 17:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-26 15:59 [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base types) Fengguang Wu
2012-09-26 17:08 ` Cyrill Gorcunov [this message]
2012-09-26 20:05 ` [next:akpm 26/413] kernel/sys.c:1868:14: sparse: incorrect type in argument 1 (different base ty Andrew Morton
2012-09-26 20:19 ` Cyrill Gorcunov
2012-09-26 21:06 ` Dan Carpenter
2012-09-26 21:17 ` Andrew Morton
2012-09-26 21:43 ` Cyrill Gorcunov

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=20120926170840.GC20086@moon \
    --to=gorcunov@openvz.org \
    --cc=kernel-janitors@vger.kernel.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