* [patch] 9p: fix min_t() casting
@ 2011-01-15 20:35 Dan Carpenter
2011-01-16 4:52 ` David Miller
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-01-15 20:35 UTC (permalink / raw)
To: Eric Van Hensbergen
Cc: David S. Miller, Sripathi Kodi, Venkateswararao Jujjuri,
Aneesh Kumar K.V, netdev, kernel-janitors
The intent here was to cap the length to USHRT_MAX, but what the
code actually does is it just casts the return from strlen() to
unsigned short and truncates the significant bits away.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/9p/protocol.c b/net/9p/protocol.c
index 1e308f2..0422581 100644
--- a/net/9p/protocol.c
+++ b/net/9p/protocol.c
@@ -403,7 +403,7 @@ p9pdu_vwritef(struct p9_fcall *pdu, int proto_version, const char *fmt,
const char *sptr = va_arg(ap, const char *);
uint16_t len = 0;
if (sptr)
- len = min_t(uint16_t, strlen(sptr),
+ len = min_t(size_t, strlen(sptr),
USHRT_MAX);
errcode = p9pdu_writef(pdu, proto_version,
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [patch] 9p: fix min_t() casting
2011-01-15 20:35 [patch] 9p: fix min_t() casting Dan Carpenter
@ 2011-01-16 4:52 ` David Miller
2011-01-16 11:45 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2011-01-16 4:52 UTC (permalink / raw)
To: error27; +Cc: ericvh, sripathik, jvrao, aneesh.kumar, netdev, kernel-janitors
From: Dan Carpenter <error27@gmail.com>
Date: Sat, 15 Jan 2011 23:35:39 +0300
> The intent here was to cap the length to USHRT_MAX, but what the
> code actually does is it just casts the return from strlen() to
> unsigned short and truncates the significant bits away.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
If you want me to apply this, it doesn't apply cleanly to net-2.6
at all.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] 9p: fix min_t() casting
2011-01-16 4:52 ` David Miller
@ 2011-01-16 11:45 ` Dan Carpenter
2011-01-16 16:33 ` Eric Van Hensbergen
0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2011-01-16 11:45 UTC (permalink / raw)
To: David Miller
Cc: ericvh, sripathik, jvrao, aneesh.kumar, netdev, kernel-janitors,
mohan
On Sat, Jan 15, 2011 at 08:52:08PM -0800, David Miller wrote:
> From: Dan Carpenter <error27@gmail.com>
> Date: Sat, 15 Jan 2011 23:35:39 +0300
>
> > The intent here was to cap the length to USHRT_MAX, but what the
> > code actually does is it just casts the return from strlen() to
> > unsigned short and truncates the significant bits away.
> >
> > Signed-off-by: Dan Carpenter <error27@gmail.com>
>
> If you want me to apply this, it doesn't apply cleanly to net-2.6
> at all.
Sorry. I screwed up.
This was on top of a patch from M. Mohan Kumar <mohan@in.ibm.com>
that hasn't hit net-2.6 yet. Mohan wasn't included on the CC
list because get_maintainer.pl changed and I didn't notice and
I wasn't careful.
Eric, could Mohan just fix his patch before it gets merged or is it
better to send these as two patches?
regards,
dan carpenter
Ps: Mohon the patch is here:
http://marc.info/?l=linux-netdev&m=129512381528034&w=2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] 9p: fix min_t() casting
2011-01-16 11:45 ` Dan Carpenter
@ 2011-01-16 16:33 ` Eric Van Hensbergen
0 siblings, 0 replies; 4+ messages in thread
From: Eric Van Hensbergen @ 2011-01-16 16:33 UTC (permalink / raw)
To: Dan Carpenter
Cc: David Miller, sripathik, jvrao, aneesh.kumar, netdev,
kernel-janitors, mohan
The patch has already made it upstream via the v9fs pull. I'll pull
in your fix Dan and request a second pull by Linus.
Thanks for catching this.
-eric
On Sun, Jan 16, 2011 at 5:45 AM, Dan Carpenter <error27@gmail.com> wrote:
> On Sat, Jan 15, 2011 at 08:52:08PM -0800, David Miller wrote:
>> From: Dan Carpenter <error27@gmail.com>
>> Date: Sat, 15 Jan 2011 23:35:39 +0300
>>
>> > The intent here was to cap the length to USHRT_MAX, but what the
>> > code actually does is it just casts the return from strlen() to
>> > unsigned short and truncates the significant bits away.
>> >
>> > Signed-off-by: Dan Carpenter <error27@gmail.com>
>>
>> If you want me to apply this, it doesn't apply cleanly to net-2.6
>> at all.
>
> Sorry. I screwed up.
>
> This was on top of a patch from M. Mohan Kumar <mohan@in.ibm.com>
> that hasn't hit net-2.6 yet. Mohan wasn't included on the CC
> list because get_maintainer.pl changed and I didn't notice and
> I wasn't careful.
>
> Eric, could Mohan just fix his patch before it gets merged or is it
> better to send these as two patches?
>
> regards,
> dan carpenter
>
> Ps: Mohon the patch is here:
> http://marc.info/?l=linux-netdev&m=129512381528034&w=2
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-16 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-15 20:35 [patch] 9p: fix min_t() casting Dan Carpenter
2011-01-16 4:52 ` David Miller
2011-01-16 11:45 ` Dan Carpenter
2011-01-16 16:33 ` Eric Van Hensbergen
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).