fix sparse warning in of_device.c
PATCH 1/1 fix sparse warning in of_device.c
Fix sparse warning:
arch/sparc/kernel/of_device.c:439:46: warning: incorrect type in argument 3 (different signedness)arch/sparc/kernel/of_device.c:439:46: expected int *lenparch/sparc/kernel/of_device.c:439:46: got unsigned int *<noident>
arch/sparc/kernel/of_device.c +1 -1
@@ -433,7 +433,7 @@ static int __init build_one_resource(str int na, int ns, int pna) { u32 *ranges; -unsigned int rlen; +int rlen;int rone; ranges =of_get_property (parent,"ranges" , &rlen);
David Miller
maintainerFrom: Robert Reif <[email protected]>
Date: Wed, 28 Mar 2007 19:07:27 -0400
Quoted 8 lines
Fix sparse warning:
arch/sparc/kernel/of_device.c:439:46: warning: incorrect type in argument 3 (different signedness)arch/sparc/kernel/of_device.c:439:46: expected int *lenparch/sparc/kernel/of_device.c:439:46: got unsigned int *<noident>Signed-off-by Robert Reif <[email protected]>
Robert, each and every one of these sparc sparse warnings applies to 64-bit sparc as well, the code is nearly identical.
I'm been hitting the sparc64 side for each of your patches, but you can help me out a lot by doing this yourself :-)
Thanks!
David Miller
maintainerFrom: Robert Reif <[email protected]>
Date: Wed, 28 Mar 2007 19:07:27 -0400
Quoted 8 lines
Fix sparse warning:
arch/sparc/kernel/of_device.c:439:46: warning: incorrect type in argument 3 (different signedness)arch/sparc/kernel/of_device.c:439:46: expected int *lenparch/sparc/kernel/of_device.c:439:46: got unsigned int *<noident>Signed-off-by Robert Reif <[email protected]>
This patch is not correct.
The loop at the end of this function depends upon the signedness of 'rlen' to handle underflow situations.
With your change to make it unsigned, the loop can possibly not terminate because if 'rlen' gets decremented below zero it will become a "very large positive number" instead of a negative one.