From 6e0652b3e58e14960bdcab0065024ec24b27b813 Mon Sep 17 00:00:00 2001 From: Arshad Hussain Date: Tue, 31 Oct 2023 16:44:49 +0530 Subject: [PATCH] LU-17000 coverity: Fix Dereference before null under obd_sysfs.c This patch fixes Dereference before null check reported by coverity run. CoverityID: 404751 ("Dereference before null") Test-Parameters: trivial Signed-off-by: Arshad Hussain Change-Id: I89bcc820244ab17a60bf1d5c86f9d6a8747b43ed Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/52903 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Timothy Day Reviewed-by: Patrick Farrell Reviewed-by: Oleg Drokin --- lustre/obdclass/obd_sysfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lustre/obdclass/obd_sysfs.c b/lustre/obdclass/obd_sysfs.c index d689480..02f6642 100644 --- a/lustre/obdclass/obd_sysfs.c +++ b/lustre/obdclass/obd_sysfs.c @@ -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"; -- 1.8.3.1