Re: Linux 2.6.34-rc3 + CAN build problem

From: NÃmeth MÃrton
Date: Sat Apr 10 2010 - 06:36:57 EST


Eric Dumazet Ãrta:
> Le samedi 10 avril 2010 Ã 10:13 +0200, NÃmeth MÃrton a Ãcrit :
>> Hi,
>>
>> I have some problem building Liunux kernel 2.6.34-rc3 with the attached .config:
>>
>> $ make clean bzImage modules
>> [...]
>> CC net/socket.o
>> LD net/802/built-in.o
>> LD net/can/built-in.o
>> CC [M] net/can/bcm.o
>> CC [M] net/can/raw.o
>> In file included from /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess.h:571,
>> from include/net/checksum.h:25,
>> from include/linux/skbuff.h:28,
>> from include/linux/if_ether.h:124,
>> from include/linux/netdevice.h:29,
>> from net/can/raw.c:48:
>> In function âcopy_from_userâ,
>> inlined from âraw_setsockoptâ at net/can/raw.c:447:
>> /mnt/store/nmarci/src/linux-2.6.34-rc3/arch/x86/include/asm/uaccess_32.h:212: error: call to âcopy_from_user_overflowâ declared with attribute error:
>> copy_from_user() buffer size is not provably correct
>> make[2]: *** [net/can/raw.o] Error 1
>> make[1]: *** [net/can] Error 2
>> make: *** [net] Error 2
>>
>>
>
> Could you give us your compiler version ?

$ gcc --version
gcc (Debian 4.4.2-9) 4.4.3 20100108 (prerelease)
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

> Code is fine, but compiler a bit dumb :(
>
> [PATCH] can: avoids a false warning
>
> At this point optlen == sizeof(sfilter) but some compilers are dumb.
>
> Reported-by: NÃmeth MÃrton <nm127@xxxxxxxxxx
> Signed-off-by: Eric Dumazet <eric.dumazet@xxxxxxxxx>
> ---
> diff --git a/net/can/raw.c b/net/can/raw.c
> index 3a7dffb..da99cf1 100644
> --- a/net/can/raw.c
> +++ b/net/can/raw.c
> @@ -445,7 +445,7 @@ static int raw_setsockopt(struct socket *sock, int level, int optname,
> return -EFAULT;
> }
> } else if (count == 1) {
> - if (copy_from_user(&sfilter, optval, optlen))
> + if (copy_from_user(&sfilter, optval, sizeof(sfilter)))
> return -EFAULT;
> }
>
>
>
>
>

--
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/