linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 1/1] rt2x00: fix "buffer size not provably correct" build warning
       [not found] <20100822223710.865969746@rtp-net.org>
@ 2010-08-22 22:37 ` Arnaud Patard
  2010-08-23  9:38   ` Ivo Van Doorn
  0 siblings, 1 reply; 2+ messages in thread
From: Arnaud Patard @ 2010-08-22 22:37 UTC (permalink / raw)
  To: Ivo van Doorn; +Cc: Gertjan van Wingerde, linux-wireless

rt2x00 debugfs interface doesn't check the size of the data coming
from userspace, leading to a build warning. Fix That.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>

Index: rt2x00/drivers/net/wireless/rt2x00/rt2x00debug.c
===================================================================
--- rt2x00.orig/drivers/net/wireless/rt2x00/rt2x00debug.c	2010-08-23 00:21:42.637941244 +0200
+++ rt2x00/drivers/net/wireless/rt2x00/rt2x00debug.c	2010-08-23 00:33:41.237941022 +0200
@@ -480,6 +480,8 @@ static ssize_t rt2x00debug_write_##__nam
 	if (index >= debug->__name.word_count)			\
 		return -EINVAL;					\
 								\
+	if (length > sizeof(line))				\
+		length = sizeof(line);				\
 	if (copy_from_user(line, buf, length))			\
 		return -EFAULT;					\
 								\



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [patch 1/1] rt2x00: fix "buffer size not provably correct" build warning
  2010-08-22 22:37 ` [patch 1/1] rt2x00: fix "buffer size not provably correct" build warning Arnaud Patard
@ 2010-08-23  9:38   ` Ivo Van Doorn
  0 siblings, 0 replies; 2+ messages in thread
From: Ivo Van Doorn @ 2010-08-23  9:38 UTC (permalink / raw)
  To: Arnaud Patard; +Cc: Gertjan van Wingerde, linux-wireless

On Mon, Aug 23, 2010 at 12:37 AM, Arnaud Patard
<arnaud.patard@rtp-net.org> wrote:
> rt2x00 debugfs interface doesn't check the size of the data coming
> from userspace, leading to a build warning. Fix That.
>
> Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
>
> Index: rt2x00/drivers/net/wireless/rt2x00/rt2x00debug.c
> ===================================================================
> --- rt2x00.orig/drivers/net/wireless/rt2x00/rt2x00debug.c       2010-08-23 00:21:42.637941244 +0200
> +++ rt2x00/drivers/net/wireless/rt2x00/rt2x00debug.c    2010-08-23 00:33:41.237941022 +0200
> @@ -480,6 +480,8 @@ static ssize_t rt2x00debug_write_##__nam
>        if (index >= debug->__name.word_count)                  \
>                return -EINVAL;                                 \
>                                                                \
> +       if (length > sizeof(line))                              \
> +               length = sizeof(line);                          \
>        if (copy_from_user(line, buf, length))                  \
>                return -EFAULT;                                 \
>                                                                \

I think it should actually return -EINVAL to clearly indicate that the
input is invalid,
rather then alter the value. rt2x00debug_write_* alters registers, so
we should not
assume anything when writing into it.

Ivo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-23  9:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20100822223710.865969746@rtp-net.org>
2010-08-22 22:37 ` [patch 1/1] rt2x00: fix "buffer size not provably correct" build warning Arnaud Patard
2010-08-23  9:38   ` Ivo Van Doorn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).