From: James Simmons Date: Sun, 20 Aug 2017 02:26:22 +0000 (-0400) Subject: staging: lustre: uapi: check if argument for lustre_cfg_buf() is NULL X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ef27faebbad8d936bd2672ed94c4b925b5c92609;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245 Reviewed-on: https://review.whamcloud.com/22138 Reviewed-by: Dmitry Eremin Reviewed-by: Jinshan Xiong Reviewed-by: Fan Yong Reviewed-by: Oleg Drokin Signed-off-by: James Simmons Signed-off-by: Greg Kroah-Hartman --- 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;