[lustre-devel] [PATCH 08/10] lustre: libcfs: test if table is NULL for lnet_insert_debugfs

James Simmons jsimmons at infradead.org
Mon Jul 2 16:24:52 PDT 2018


It is possible to call lnet_insert_debugfs() with table being NULL.
We can avoid a potential oops by adding a test to see if table is
not NULL.

Signed-off-by: James Simmons <uja.ornl at yahoo.com>
WC-bug-id: https://jira.whamcloud.com/browse/LU-8066
Reviewed-on: https://review.whamcloud.com/24688
Reviewed-by: Dmitry Eremin <dmitry.eremin at intel.com>
Reviewed-by: Olaf Weber <olaf.weber at hpe.com>
Signed-off-by: James Simmons <jsimmons at infradead.org>
---
 drivers/staging/lustre/lnet/libcfs/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/libcfs/module.c b/drivers/staging/lustre/lnet/libcfs/module.c
index 2c4268b..0d36121 100644
--- a/drivers/staging/lustre/lnet/libcfs/module.c
+++ b/drivers/staging/lustre/lnet/libcfs/module.c
@@ -659,7 +659,7 @@ void lnet_insert_debugfs(struct ctl_table *table)
 	 * We don't save the dentry returned because we don't call
 	 * debugfs_remove() but rather remove_recursive()
 	 */
-	for (; table->procname; table++)
+	for (; table && table->procname; table++)
 		debugfs_create_file(table->procname, table->mode,
 				    lnet_debugfs_root, table,
 				    lnet_debugfs_fops_select(table->mode));
-- 
1.8.3.1



More information about the lustre-devel mailing list