On Sun, Jan 30, 2011 at 00:00, Stefan Weil <stefan@xxxxxxxxxxx> wrote: > Am 29.01.2011 22:38, schrieb Jesper Juhl: >> On Sat, 29 Jan 2011, Stefan Weil wrote: >>> This error was reported by cppcheck: >>> drivers/s390/net/smsgiucv.c:63: error: Using sizeof for array given as >>> function argument returns the size of pointer. >>> >>> Although there is no runtime problem as long as sizeof(u8 *) == 8, >>> this misleading code should get fixed. >>> >>> Cc: Ursula Braun<ursula.braun@xxxxxxxxxx> >>> Cc: linux390@xxxxxxxxxx >>> Cc: Frank Blaschka<blaschka@xxxxxxxxxxxxxxxxxx> >>> Cc: Martin Schwidefsky<schwidefsky@xxxxxxxxxx> >>> Cc: Heiko Carstens<heiko.carstens@xxxxxxxxxx> >>> Cc: linux-s390@xxxxxxxxxxxxxxx >>> Cc: linux-kernel@xxxxxxxxxxxxxxx >>> Signed-off-by: Stefan Weil<weil@xxxxxxxxxxxxxxx> >>> --- >>> Âdrivers/s390/net/smsgiucv.c | Â Â2 +- >>> Â1 files changed, 1 insertions(+), 1 deletions(-) >>> >>> diff --git a/drivers/s390/net/smsgiucv.c b/drivers/s390/net/smsgiucv.c >>> index 65e1cf1..207b7d7 100644 >>> --- a/drivers/s390/net/smsgiucv.c >>> +++ b/drivers/s390/net/smsgiucv.c >>> @@ -60,7 +60,7 @@ static struct iucv_handler smsg_handler = { >>> Âstatic int smsg_path_pending(struct iucv_path *path, u8 ipvmid[8], >>> Â Â Â Â Â Â Â Â Â Â Â Â Â Â u8 ipuser[16]) >>> Â{ >>> - Â Â Â if (strncmp(ipvmid, "*MSG Â Â", sizeof(ipvmid)) != 0) >>> + Â Â Â if (strncmp(ipvmid, "*MSG Â Â", 8) != 0) >>> >> >> Hmm, shouldn't this really be ÂARRAY_SIZE(ipvmid) Â?? >> > > I think that would be wrong, too (only in this special case where > an array is passed as a function parameter). Yeah, I got b itten by that recently as well: if `u8 ipvmid[8]' is a variable, `sizeof(ipvmid) == 8'. If it's a function parameter, `sizeof(ipvmid) == sizeof(void *)'. Gr{oetje,eeting}s, Â Â Â Â Â Â Â Â Â Â Â Â Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. Â Â Â Â Â Â Â Â Â Â Â Â Â ÂÂ ÂÂ -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-s390" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html