diff options
Diffstat (limited to 'drivers/staging/lustre/lustre/include/lustre_cfg.h')
-rw-r--r-- | drivers/staging/lustre/lustre/include/lustre_cfg.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/staging/lustre/lustre/include/lustre_cfg.h b/drivers/staging/lustre/lustre/include/lustre_cfg.h index 7b385b872..eb6b292b7 100644 --- a/drivers/staging/lustre/lustre/include/lustre_cfg.h +++ b/drivers/staging/lustre/lustre/include/lustre_cfg.h @@ -157,6 +157,7 @@ static inline void *lustre_cfg_buf(struct lustre_cfg *lcfg, int index) int i; int offset; int bufcount; + LASSERT (lcfg != NULL); LASSERT (index >= 0); @@ -174,6 +175,7 @@ static inline void lustre_cfg_bufs_init(struct lustre_cfg_bufs *bufs, struct lustre_cfg *lcfg) { int i; + bufs->lcfg_bufcount = lcfg->lcfg_bufcount; for (i = 0; i < bufs->lcfg_bufcount; i++) { bufs->lcfg_buflen[i] = lcfg->lcfg_buflens[i]; @@ -200,6 +202,7 @@ static inline char *lustre_cfg_string(struct lustre_cfg *lcfg, int index) int last = min((int)lcfg->lcfg_buflens[index], cfs_size_round(lcfg->lcfg_buflens[index]) - 1); char lost = s[last]; + s[last] = '\0'; if (lost != '\0') { CWARN("Truncated buf %d to '%s' (lost '%c'...)\n", @@ -221,7 +224,6 @@ static inline int lustre_cfg_len(__u32 bufcount, __u32 *buflens) return cfs_size_round(len); } - #include "obd_support.h" static inline struct lustre_cfg *lustre_cfg_new(int cmd, @@ -231,8 +233,8 @@ static inline struct lustre_cfg *lustre_cfg_new(int cmd, char *ptr; int i; - OBD_ALLOC(lcfg, lustre_cfg_len(bufs->lcfg_bufcount, - bufs->lcfg_buflen)); + lcfg = kzalloc(lustre_cfg_len(bufs->lcfg_bufcount, bufs->lcfg_buflen), + GFP_NOFS); if (!lcfg) return ERR_PTR(-ENOMEM); @@ -254,7 +256,7 @@ static inline void lustre_cfg_free(struct lustre_cfg *lcfg) len = lustre_cfg_len(lcfg->lcfg_bufcount, lcfg->lcfg_buflens); - OBD_FREE(lcfg, len); + kfree(lcfg); return; } |