From: Al Viro <viro@ZenIV.linux.org.uk>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Harvey Harrison <harvey.harrison@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] mtd: mtdchar.c silence sparse warning
Date: Thu, 15 May 2008 02:46:00 +0100 [thread overview]
Message-ID: <20080515014600.GR13907@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20080514183837.460ba848.akpm@linux-foundation.org>
On Wed, May 14, 2008 at 06:38:37PM -0700, Andrew Morton wrote:
> > - if (copy_to_user(&((struct mtd_oob_buf *)argp)->length,
> > + if (copy_to_user(argp + offsetof(struct mtd_oob_buf, length),
> > &retlen, sizeof(buf.length)))
> > ret = -EFAULT;
>
> Cleaner would be:
>
> struct mtd_oob_buf __user *user_mtd_oob_buf = argp;
>
> if (copy_to_user(&user_mtd_oob_buf->length, ...
Yup. BTW, &((type __user *)p)->field) would work just fine too, but yeah,
local variable like that would be cleaner.
prev parent reply other threads:[~2008-05-15 1:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 1:22 [PATCH 1/2] mtd: mtdchar.c silence sparse warning Harvey Harrison
2008-05-15 1:38 ` Andrew Morton
2008-05-15 1:46 ` Al Viro [this message]
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=20080515014600.GR13907@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=akpm@linux-foundation.org \
--cc=dwmw2@infradead.org \
--cc=harvey.harrison@gmail.com \
--cc=linux-kernel@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