Whamcloud - gitweb
LU-17000 coverity: Fix Dereference before null under obd_sysfs.c 03/52903/2
authorArshad Hussain <arshad.hussain@aeoncomputing.com>
Tue, 31 Oct 2023 11:14:49 +0000 (16:44 +0530)
committerOleg Drokin <green@whamcloud.com>
Sat, 18 Nov 2023 21:46:27 +0000 (21:46 +0000)
This patch fixes Dereference before null check reported
by coverity run.

CoverityID: 404751 ("Dereference before null")

Test-Parameters: trivial
Signed-off-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Change-Id: I89bcc820244ab17a60bf1d5c86f9d6a8747b43ed
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52903
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Timothy Day <timday@amazon.com>
Reviewed-by: Patrick Farrell <pfarrell@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/obdclass/obd_sysfs.c

index d689480..02f6642 100644 (file)
@@ -506,13 +506,14 @@ static void *obd_device_list_seq_next(struct seq_file *p, void *v, loff_t *pos)
 static int obd_device_list_seq_show(struct seq_file *p, void *v)
 {
        struct obd_device *obd = v;
-       int dev_no = obd->obd_minor;
        char *status;
+       int dev_no;
 
        if (!obd)
                return 0;
 
        LASSERT(obd->obd_magic == OBD_DEVICE_MAGIC);
+       dev_no = obd->obd_minor;
 
        if (obd->obd_stopping)
                status = "ST";