Re: [PATCH] floppy: Add an extra bound check on ioctl arguments

From: Arjan van de Ven
Date: Thu Oct 01 2009 - 17:51:09 EST


On Wed, 30 Sep 2009 16:13:16 -0700
Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Wed, 30 Sep 2009 13:17:09 +0200
> Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
>
> > gcc is not convinced that the floppy.c ioctl has sufficient bound
> > checks,
>
> gad. You said "floppy" and "ioctl" in the same sentence. Where
> angels fear to tread.

I have to admit I was very much not looking forward to working on this
warning, and made sure to wear protective clothing and that my
immunizations were up to date.
>
> It would be useful if you were to quote the gcc output in the
> changelog please.


In function âcopy_from_userâ,
inlined from âfd_copyinâ at drivers/block/floppy.c:3080,
inlined from âfd_ioctlâ at drivers/block/floppy.c:3503:
/home/arjan/linux/arch/x86/include/asm/uaccess_32.h:211:
warning: call to âcopy_from_user_overflowâ declared with attribute
warning: copy_from_user buffer size is not provably correct

> I assume that you're using some magical new gcc
> option or something?

Not so much a new option, as using an option that has been there for a
while, and has been used extensively in userspace, just not yet in the
kernel. The patches are in the -tip tree, but if you want to take a
peek I can send them to you as well... they find some "interesting"
stuff.


--
Arjan van de Ven Intel Open Source Technology Centre
For development, discussion and tips for power savings,
visit http://www.lesswatts.org
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/