[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20080515014600.GR13907@ZenIV.linux.org.uk>
Date: Thu, 15 May 2008 02:46:00 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Harvey Harrison <harvey.harrison@...il.com>,
David Woodhouse <dwmw2@...radead.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/2] mtd: mtdchar.c silence sparse warning
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists