Hello Dan, Thanks to report this. This issue was fixed in our code but not up streamed yet. The patch is available http://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commit;h=d47f00d5a420b594b49564b2e00efca4602c3fb5 index 02764bd..c8ce66c 100644 --- a/lustre/obdclass/lprocfs_status.c +++ b/lustre/obdclass/lprocfs_status.c @@ -789,14 +789,17 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data seq_printf(m, "%s%s", j ? ", " : "", nidstr); j++; } - libcfs_nid2str_r(imp->imp_connection->c_peer.nid, - nidstr, sizeof(nidstr)); + if (imp->imp_connection != NULL) + libcfs_nid2str_r(imp->imp_connection->c_peer.nid, + nidstr, sizeof(nidstr)); + else + strncpy(nidstr, "<none>", sizeof(nidstr)); seq_printf(m, " ]\n" " current_connection: %s\n" " connection_attempts: %u\n" " generation: %u\n" " in-progress_invalidations: %u\n", - imp->imp_connection == NULL ? "<none>" : nidstr, + nidstr, imp->imp_conn_cnt, imp->imp_generation, atomic_read(&imp->imp_inval_count)); Dmitry. > -----Original Message----- > From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx] > Sent: Tuesday, November 3, 2015 3:11 PM > To: Eremin, Dmitry <dmitry.eremin@xxxxxxxxx> > Cc: devel@xxxxxxxxxxxxxxxxxxxx > Subject: re: staging: lustre: provide separate buffers for libcfs_*2str() > > Hello Dmitry Eremin, > > This is a semi-automatic email about new static checker warnings. > > The patch 80feb1ef349e: "staging: lustre: provide separate buffers for > libcfs_*2str()" from Oct 21, 2015, leads to the following Smatch > complaint: > > drivers/staging/lustre/lustre/obdclass/lprocfs_status.c:676 > lprocfs_rd_import() > warn: variable dereferenced before check 'imp->imp_connection' > (see line 668) > > drivers/staging/lustre/lustre/obdclass/lprocfs_status.c > 667 } > 668 libcfs_nid2str_r(imp->imp_connection->c_peer.nid, > ^^^^^^^^^^^^^^^^^^^^^ Patch introduces a new > dereference. > > 669 nidstr, sizeof(nidstr)); > 670 seq_printf(m, > 671 "]\n" > 672 " current_connection: %s\n" > 673 " connection_attempts: %u\n" > 674 " generation: %u\n" > 675 " in-progress_invalidations: %u\n", > 676 imp->imp_connection == NULL ? "<none>" : nidstr, > ^^^^^^^^^^^^^^^^^^^ Old code assumes it can be NULL. > > 677 imp->imp_conn_cnt, > 678 imp->imp_generation, > > regards, > dan carpenter -------------------------------------------------------------------- Joint Stock Company Intel A/O Registered legal address: Krylatsky Hills Business Park, 17 Krylatskaya Str., Bldg 4, Moscow 121614, Russian Federation This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel