bcma: signedness bug in bcma_get_next_core()
Subsystems (2)
PATCH 1/1 bcma: signedness bug in bcma_get_next_core()
The u32 would never be less than zero so the error handling would break. I changed it to int.
drivers/bcma/scan.c +1 -1
@@ -281,7 +281,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,/* get & parse master ports */ for (i =0 ; i < ports[0 ]; i++) { -u32 mst_port_d =bcma_erom_get_mst_port (bus, eromptr); +int mst_port_d =bcma_erom_get_mst_port (bus, eromptr);if (mst_port_d <0 )return -EILSEQ ; }
Rafał Miłecki
maintainerW dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
In declaration we use s32:
static s32 bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
Doesn't it sound better to use s32 instead of int?
Signature · 1 line
Rafał
Am 20.08.2011 14:23, schrieb Rafał Miłecki:
Quoted 10 lines
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);Doesn't it sound better to use s32 instead of int?
aktualy int sounds better that s32 for me.
re,
wh
Rafał Miłecki
maintainerQuoted 8 lines · W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <[email protected]> napisał:
Am 20.08.2011 14:23, schrieb Rafał Miłecki:
Quoted 5 lines
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
Quoted 7 lines
Quoted 5 lines
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);Doesn't it sound better to use s32 instead of int?
aktualy int sounds better that s32 for me.
Will you care to replace function return type as well?
Signature · 1 line
Rafał
Am 20.08.2011 15:31, schrieb Rafał Miłecki:
Quoted 12 lines
Quoted 11 lines · W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <[email protected]> napisał:
Am 20.08.2011 14:23, schrieb Rafał Miłecki:
Quoted 8 lines
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Doesn't it sound better to use s32 instead of int?
aktualy int sounds better that s32 for me.
Will you care to replace function return type as well?
not me, i would have to download a decent kernel etc, just to change an s32 into int.
re,
wh
Rafał Miłecki
maintainerQuoted 18 lines · W dniu 20 sierpnia 2011 16:11 użytkownik walter harms <[email protected]> napisał:
Am 20.08.2011 15:31, schrieb Rafał Miłecki:
Quoted 15 lines
Quoted 14 lines · W dniu 20 sierpnia 2011 14:59 użytkownik walter harms <[email protected]> napisał:
Am 20.08.2011 14:23, schrieb Rafał Miłecki:
Quoted 10 lines
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);Doesn't it sound better to use s32 instead of int?
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
aktualy int sounds better that s32 for me.
Will you care to replace function return type as well?
not me, i would have to download a decent kernel etc, just to change an s32 into int.
Ups, sorry, replied too fast without checking the person I ask for.
Dan: can you change the function as well?
Signature · 1 line
Rafał
Quoted 10 lines · Rafał Miłecki
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);Doesn't it sound better to use s32 instead of int?
I don't know. I think I'm going to trust the original author on this one. I'll send you a v2 that uses s32.
regards,
dan carpenter
PATCH v2 1/1 bcma: signedness bug in bcma_get_next_core()
In reply to Rafał MiłeckiThe u32 would never be less than zero so the error handling would break. I changed it to s32 to match how bcma_erom_get_mst_port() is declared.
---
v2: the first version used "int" instead of "s32".
drivers/bcma/scan.c +1 -1
@@ -281,7 +281,7 @@ static int bcma_get_next_core(struct bcma_bus *bus, u32 __iomem **eromptr,/* get & parse master ports */ for (i =0 ; i < ports[0 ]; i++) { -u32 mst_port_d =bcma_erom_get_mst_port (bus, eromptr); +s32 mst_port_d =bcma_erom_get_mst_port (bus, eromptr);if (mst_port_d <0 )return -EILSEQ ; }
Rafał Miłecki
maintainerW dniu 23 sierpnia 2011 21:13 użytkownik Dan Carpenter
Quoted 6 lines · <[email protected]> napisał:
Quoted 5 lines · Rafał Miłecki
W dniu 18 sierpnia 2011 15:38 użytkownik Dan Carpenter
Quoted 2 lines · <[email protected]> napisał:
The u32 would never be less than zero so the error handling would break. I changed it to int.
Quoted 8 lines
Quoted 5 lines
In declaration we use s32:
static s32bcma_erom_get_mst_port(struct bcma_bus *bus, u32 **eromptr);Doesn't it sound better to use s32 instead of int?
I don't know. I think I'm going to trust the original author on this one. I'll send you a v2 that uses s32.
Dan, I asked you to use int in both: call and function declaration. I'm the author of that code, and I don't have anything against modifying that :)
I think int is used much more often that s32 for errors.
Signature · 1 line
Rafał
Quoted 6 lines · Rafał Miłecki
Dan, I asked you to use int in both: call and function declaration. I'm the author of that code, and I don't have anything against modifying that :)
I think int is used much more often that s32 for errors.
No problem. Should I make bcma_erom_get_mst_port() return 0 on success while I'm at it?
regards,
dan carpenter