From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Mundt <lethal@linux-sh.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2] fbcmap: integer overflow bug
Date: Mon, 15 Nov 2010 08:01:14 +0000 [thread overview]
Message-ID: <4CE0E8CA.9010704@bfs.de> (raw)
In-Reply-To: <20101115072014.GB21614@bicker>
Am 15.11.2010 08:20, schrieb Dan Carpenter:
> On Mon, Nov 15, 2010 at 07:56:05AM +0100, Geert Uytterhoeven wrote:
>> On Mon, Nov 15, 2010 at 05:48, Paul Mundt <lethal@linux-sh.org> wrote:
>>> On Sat, Nov 13, 2010 at 01:07:18PM +0300, Dan Carpenter wrote:
>>>> @@ -256,8 +264,12 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
>>>> int rc, size = cmap->len * sizeof(u16);
>>>> struct fb_cmap umap;
>>>>
>>>> + if (cmap->len * 2 > INT_MAX)
>>
>> Isn't that another integer overflow? I.e. should be "if (cmap->len >
>> INT_MAX / sizeof(u16))" instead?
>>
>
> Yeah it is. :/
>
> I'll change it to:
> if (size < 0 || size < cmap->len)
> like Paul asked.
>
I do not see the rest of the code but it looks like
cmap->len is size in int8_t. So the upper limit is something like
INT_MAX/(sizeof(u16)*2). Perhaps we can call it a char ?
is there ANY system that has a more than 256 colors in R|G|B ?
<spying for struct fb_cmap_user >
__u32 len;
__u16 __user *red;
So no need to check for <0.
hope that helps,
re,
wh
WARNING: multiple messages have this Message-ID (diff)
From: walter harms <wharms@bfs.de>
To: Dan Carpenter <error27@gmail.com>,
Geert Uytterhoeven <geert@linux-m68k.org>,
Paul Mundt <lethal@linux-sh.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [patch 2/2] fbcmap: integer overflow bug
Date: Mon, 15 Nov 2010 09:01:14 +0100 [thread overview]
Message-ID: <4CE0E8CA.9010704@bfs.de> (raw)
In-Reply-To: <20101115072014.GB21614@bicker>
Am 15.11.2010 08:20, schrieb Dan Carpenter:
> On Mon, Nov 15, 2010 at 07:56:05AM +0100, Geert Uytterhoeven wrote:
>> On Mon, Nov 15, 2010 at 05:48, Paul Mundt <lethal@linux-sh.org> wrote:
>>> On Sat, Nov 13, 2010 at 01:07:18PM +0300, Dan Carpenter wrote:
>>>> @@ -256,8 +264,12 @@ int fb_set_user_cmap(struct fb_cmap_user *cmap, struct fb_info *info)
>>>> int rc, size = cmap->len * sizeof(u16);
>>>> struct fb_cmap umap;
>>>>
>>>> + if (cmap->len * 2 > INT_MAX)
>>
>> Isn't that another integer overflow? I.e. should be "if (cmap->len >
>> INT_MAX / sizeof(u16))" instead?
>>
>
> Yeah it is. :/
>
> I'll change it to:
> if (size < 0 || size < cmap->len)
> like Paul asked.
>
I do not see the rest of the code but it looks like
cmap->len is size in int8_t. So the upper limit is something like
INT_MAX/(sizeof(u16)*2). Perhaps we can call it a char ?
is there ANY system that has a more than 256 colors in R|G|B ?
<spying for struct fb_cmap_user >
__u32 len;
__u16 __user *red;
So no need to check for <0.
hope that helps,
re,
wh
next prev parent reply other threads:[~2010-11-15 8:01 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-27 9:37 [RFC] [patch] fbcmap: integer overflow bug Dan Carpenter
2010-10-27 9:37 ` Dan Carpenter
2010-11-05 20:40 ` Andrew Morton
2010-11-05 20:40 ` Andrew Morton
2010-11-13 10:06 ` [patch 1/2] fbcmap: cleanup white space in fb_alloc_cmap() Dan Carpenter
2010-11-13 10:06 ` Dan Carpenter
2010-11-18 6:00 ` Paul Mundt
2010-11-18 6:00 ` Paul Mundt
2010-11-13 10:07 ` [patch 2/2] fbcmap: integer overflow bug Dan Carpenter
2010-11-13 10:07 ` Dan Carpenter
2010-11-15 4:48 ` Paul Mundt
2010-11-15 4:48 ` Paul Mundt
2010-11-15 6:56 ` Geert Uytterhoeven
2010-11-15 6:56 ` Geert Uytterhoeven
2010-11-15 7:20 ` Dan Carpenter
2010-11-15 7:20 ` Dan Carpenter
2010-11-15 7:20 ` Dan Carpenter
2010-11-15 8:01 ` walter harms [this message]
2010-11-15 8:01 ` walter harms
2010-11-15 8:14 ` Dan Carpenter
2010-11-15 8:14 ` Dan Carpenter
2010-11-16 9:11 ` [patch 2/2 v2] " Dan Carpenter
2010-11-16 9:11 ` Dan Carpenter
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=4CE0E8CA.9010704@bfs.de \
--to=wharms@bfs.de \
--cc=akpm@linux-foundation.org \
--cc=error27@gmail.com \
--cc=geert@linux-m68k.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=lethal@linux-sh.org \
--cc=linux-fbdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.