[LU-7380] Potential variable dereferenced bufer check in lprocfs_status.c Created: 03/Nov/15  Updated: 04/Nov/15  Resolved: 04/Nov/15

Status: Closed
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.8.0
Fix Version/s: None

Type: Bug Priority: Minor
Reporter: James A Simmons Assignee: WC Triage
Resolution: Duplicate Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

After the merger of LU-6070 to the upstream client Dan Carpenter reported the follow smatch warning:

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,



 Comments   
Comment by Dmitry Eremin (Inactive) [ 04/Nov/15 ]

This is duplicate of LU-6507

Generated at Sat Feb 10 02:08:24 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.