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>
This commit is contained in:
James Simmons 2017-08-19 22:26:22 -04:00 committed by Greg Kroah-Hartman
parent 63d384bfa6
commit ef27faebba

View file

@ -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;