Do not assign newmod a value past the end of the allocated
space. This can confuse coverity.
Instead only assign valid addresses (or NULL).
CoverityID: 410235 ("Memory - illegal access")
Signed-off-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Change-Id: I767ed1273ebfab68d634b3ff22b81a4621405dd2
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53315
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Arshad Hussain <arshad.hussain@aeoncomputing.com>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
return -EIO;
while ((tok = strtok(NULL, " \t\n")) != NULL) {
- struct nss_module *newmod = g_nss_modules + g_n_nss_modules;
+ struct nss_module *newmod = NULL;
- if (g_n_nss_modules >= NSS_MODULES_MAX_NR)
+ if (g_n_nss_modules < NSS_MODULES_MAX_NR)
+ newmod = &g_nss_modules[g_n_nss_modules];
+ else
return -ERANGE;
if (!strcmp(tok, "files") || !strcmp(tok, "lustre"))