Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
LU-5577 ptlrpc: fix comparison between signed and unsigned
[fs/lustre-release.git]
/
lustre
/
quota
/
qmt_dev.c
diff --git
a/lustre/quota/qmt_dev.c
b/lustre/quota/qmt_dev.c
index
012b11d
..
8b501c3
100644
(file)
--- a/
lustre/quota/qmt_dev.c
+++ b/
lustre/quota/qmt_dev.c
@@
-202,12
+202,17
@@
static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
struct lu_device *ld = qmt2lu_dev(qmt);
struct obd_device *obd, *mdt_obd;
struct obd_type *type;
struct lu_device *ld = qmt2lu_dev(qmt);
struct obd_device *obd, *mdt_obd;
struct obd_type *type;
+ char *svname = lustre_cfg_string(cfg, 0);
int rc;
ENTRY;
int rc;
ENTRY;
+ if (svname == NULL)
+ RETURN(-EINVAL);
+
/* record who i am, it might be useful ... */
/* record who i am, it might be useful ... */
- strncpy(qmt->qmt_svname, lustre_cfg_string(cfg, 0),
- sizeof(qmt->qmt_svname) - 1);
+ rc = strlcpy(qmt->qmt_svname, svname, sizeof(qmt->qmt_svname));
+ if (rc >= sizeof(qmt->qmt_svname))
+ RETURN(-E2BIG);
/* look-up the obd_device associated with the qmt */
obd = class_name2obd(qmt->qmt_svname);
/* look-up the obd_device associated with the qmt */
obd = class_name2obd(qmt->qmt_svname);
@@
-237,7
+242,7
@@
static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
/* set up and start rebalance thread */
thread_set_flags(&qmt->qmt_reba_thread, SVC_STOPPED);
init_waitqueue_head(&qmt->qmt_reba_thread.t_ctl_waitq);
/* set up and start rebalance thread */
thread_set_flags(&qmt->qmt_reba_thread, SVC_STOPPED);
init_waitqueue_head(&qmt->qmt_reba_thread.t_ctl_waitq);
-
CFS_
INIT_LIST_HEAD(&qmt->qmt_reba_list);
+ INIT_LIST_HEAD(&qmt->qmt_reba_list);
spin_lock_init(&qmt->qmt_reba_lock);
rc = qmt_start_reba_thread(qmt);
if (rc) {
spin_lock_init(&qmt->qmt_reba_lock);
rc = qmt_start_reba_thread(qmt);
if (rc) {
@@
-252,8
+257,8
@@
static int qmt_device_init0(const struct lu_env *env, struct qmt_device *qmt,
LASSERT(type != NULL);
/* register proc directory associated with this qmt */
LASSERT(type != NULL);
/* register proc directory associated with this qmt */
- qmt->qmt_proc = lprocfs_register(qmt->qmt_svname, type->typ_procroot,
- NULL, NULL);
+ qmt->qmt_proc = lprocfs_
seq_
register(qmt->qmt_svname, type->typ_procroot,
+
NULL, NULL);
if (IS_ERR(qmt->qmt_proc)) {
rc = PTR_ERR(qmt->qmt_proc);
CERROR("%s: failed to create qmt proc entry (%d)\n",
if (IS_ERR(qmt->qmt_proc)) {
rc = PTR_ERR(qmt->qmt_proc);
CERROR("%s: failed to create qmt proc entry (%d)\n",
@@
-466,11
+471,8
@@
int qmt_glb_init(void)
int rc;
ENTRY;
int rc;
ENTRY;
- rc = class_register_type(&qmt_obd_ops, NULL, NULL,
-#ifndef HAVE_ONLY_PROCFS_SEQ
- NULL,
-#endif
- LUSTRE_QMT_NAME, &qmt_device_type);
+ rc = class_register_type(&qmt_obd_ops, NULL, true, NULL,
+ LUSTRE_QMT_NAME, &qmt_device_type);
RETURN(rc);
}
RETURN(rc);
}