Skip to content

Commit

Permalink
arch/x86/kernel/pci-calgary_64.c: change simple_strtol to simple_strtoul
Browse files Browse the repository at this point in the history
Impact: fix theoretical option string parsing overflow

Since bridge is unsigned, it would seem better to use simple_strtoul that
simple_strtol.

A simplified version of the semantic patch that makes this change is as
follows: (http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r2@
long e;
position p;
@@

e = simple_strtol@p(...)

@@
position p != r2.p;
type T;
T e;
@@

e =
- simple_strtol@p
+ simple_strtoul
  (...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: muli@il.ibm.com
Cc: jdmason@kudzu.us
Cc: discuss@x86-64.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Julia Lawall authored and Ingo Molnar committed Nov 25, 2008
1 parent 5cf02b7 commit eff79ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/kernel/pci-calgary_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1567,7 +1567,7 @@ static int __init calgary_parse_options(char *p)
++p;
if (*p == '\0')
break;
bridge = simple_strtol(p, &endp, 0);
bridge = simple_strtoul(p, &endp, 0);
if (p == endp)
break;

Expand Down

0 comments on commit eff79ae

Please sign in to comment.