summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Simmons <jsimmons@infradead.org>2017-08-19 22:26:22 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-08-22 18:36:49 -0700
commitef27faebbad8d936bd2672ed94c4b925b5c92609 (patch)
treee2724814d74e0a556d8f25fd2c8bfeaefc1b7bcf
parent63d384bfa650f066f44c35b92173d54545dbaf25 (diff)
downloadcachepc-linux-ef27faebbad8d936bd2672ed94c4b925b5c92609.tar.gz
cachepc-linux-ef27faebbad8d936bd2672ed94c4b925b5c92609.zip
staging: lustre: uapi: check if argument for lustre_cfg_buf() is NULL
Check if lcfg passed in is NULL and if it is just return NULL. Signed-off-by: James Simmons <uja.ornl@yahoo.com> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: https://review.whamcloud.com/22138 Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com> Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com> Reviewed-by: Fan Yong <fan.yong@intel.com> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com> Signed-off-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/staging/lustre/include/uapi/linux/lustre/lustre_cfg.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_cfg.h b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_cfg.h
index 4d2393870ccd..4208d61cb37b 100644
--- a/drivers/staging/lustre/include/uapi/linux/lustre/lustre_cfg.h
+++ b/drivers/staging/lustre/include/uapi/linux/lustre/lustre_cfg.h
@@ -161,6 +161,9 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, __u32 index)
size_t offset;
__u32 bufcount;
+ if (!lcfg)
+ return NULL;
+
bufcount = lcfg->lcfg_bufcount;
if (index >= bufcount)
return NULL;