linux-edac.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] EDAC/igen6: Add EDAC driver for Intel client SoCs using IBECC
@ 2022-01-25  5:51 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2022-01-25  5:51 UTC (permalink / raw)
  To: qiuxu.zhuo; +Cc: linux-edac

Hello Qiuxu Zhuo,

The patch 10590a9d4f23: "EDAC/igen6: Add EDAC driver for Intel client
SoCs using IBECC" from Nov 5, 2020, leads to the following Smatch
static checker warning:

drivers/edac/igen6_edac.c:1275 igen6_init() warn: strncmp() with weird length: 10 vs 11
drivers/edac/i10nm_base.c:552 i10nm_init() warn: strncmp() with weird length: 10 vs 11
drivers/edac/sb_edac.c:3510 sbridge_init() warn: strncmp() with weird length: 7 vs 8
drivers/edac/skx_base.c:657 skx_init() warn: strncmp() with weird length: 8 vs 9
drivers/edac/pnd2_edac.c:1554 pnd2_init() warn: strncmp() with weird length: 9 vs 10
drivers/edac/amd64_edac.c:4266 amd64_edac_init() warn: strncmp() with weird length: 10 vs 11

drivers/edac/igen6_edac.c
    1265 };
    1266 
    1267 static int __init igen6_init(void)
    1268 {
    1269         const char *owner;
    1270         int rc;
    1271 
    1272         edac_dbg(2, "\n");
    1273 
    1274         owner = edac_get_owner();
--> 1275         if (owner && strncmp(owner, EDAC_MOD_STR, sizeof(EDAC_MOD_STR)))

Was strncmp() really intended?  Because this is 100% the equivalent to
strcmp() with no limit.  Maybe sizeof(EDAC_MOD_STR) - 1?

    1276                 return -ENODEV;
    1277 
    1278         edac_op_state = EDAC_OPSTATE_NMI;
    1279 
    1280         rc = pci_register_driver(&igen6_driver);
    1281         if (rc)
    1282                 return rc;
    1283 
    1284         igen6_printk(KERN_INFO, "%s\n", IGEN6_REVISION);
    1285 
    1286         return 0;
    1287 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-01-25  5:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-25  5:51 [bug report] EDAC/igen6: Add EDAC driver for Intel client SoCs using IBECC Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).