Messages in this thread | | | From | Jörg-Volker Peetz <> | Subject | Re: [PATCH 1/4] drivers/net/enic: decrement sizeof size in strncmp | Date | Thu, 12 Nov 2009 11:05:54 +0100 |
| |
Julia Lawall wrote: <snip> > strncmp(foo, abc, > - sizeof(abc) > + sizeof(abc)-1 > ) <snip> > - if (strncmp(fw_info->hw_version, "A1", sizeof("A1")) == 0) > + if (strncmp(fw_info->hw_version, "A1", sizeof("A1") - 1) == 0) > *hw_ver = VNIC_DEV_HW_VER_A1; > - else if (strncmp(fw_info->hw_version, "A2", sizeof("A2")) == 0) > + else if (strncmp(fw_info->hw_version, "A2", sizeof("A2") - 1) == 0) <snip> Why not use strlen(abc) instead of sizeof(abc) - 1 ? -- Regards, Jörg-Volker.
-- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |