X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fquota%2Fqmt_dev.c;h=7c41c1a62d1ae36036af4d486f66d529efc6f3fe;hb=f26cdd1c6e1d0570f2debc13b4165a0c710f6fe5;hp=0bd91e7ef50e65e124b6a7bf8c06a055b3dd3ae8;hpb=c2c28f2aa5d65d889bf5d1a707fec82e8f852c86;p=fs%2Flustre-release.git diff --git a/lustre/quota/qmt_dev.c b/lustre/quota/qmt_dev.c index 0bd91e7..7c41c1a 100644 --- a/lustre/quota/qmt_dev.c +++ b/lustre/quota/qmt_dev.c @@ -21,7 +21,7 @@ * GPL HEADER END */ /* - * Copyright (c) 2012, Intel Corporation. + * Copyright (c) 2012, 2014, Intel Corporation. * Use is subject to license terms. * * Author: Johann Lombardi @@ -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; + char *svname = lustre_cfg_string(cfg, 0); int rc; ENTRY; + if (svname == NULL) + RETURN(-EINVAL); + /* 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); @@ -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 */ - qmt->qmt_proc = lprocfs_seq_register(qmt->qmt_svname, type->typ_procroot, - NULL, NULL); + qmt->qmt_proc = lprocfs_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", @@ -467,9 +472,6 @@ int qmt_glb_init(void) ENTRY; rc = class_register_type(&qmt_obd_ops, NULL, true, NULL, -#ifndef HAVE_ONLY_PROCFS_SEQ - NULL, -#endif LUSTRE_QMT_NAME, &qmt_device_type); RETURN(rc); }