Whamcloud - gitweb
LU-5577 mdc: fix comparison between signed and unsigned
[fs/lustre-release.git] / lustre / mdc / mdc_request.c
index ca463cd..f43caa8 100644 (file)
@@ -520,7 +520,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
                 if (rc < 0)
                         GOTO(out, rc);
 
-                if (rc < sizeof(*md->lsm)) {
+               if (rc < (typeof(rc))sizeof(*md->lsm)) {
                         CDEBUG(D_INFO, "lsm size too small: "
                                "rc < sizeof (*md->lsm) (%d < %d)\n",
                                rc, (int)sizeof(*md->lsm));
@@ -555,7 +555,7 @@ int mdc_get_lustre_md(struct obd_export *exp, struct ptlrpc_request *req,
                        if (rc < 0)
                                GOTO(out, rc);
 
-                       if (rc < sizeof(*md->lmv)) {
+                       if (rc < (typeof(rc))sizeof(*md->lmv)) {
                                CDEBUG(D_INFO, "size too small:  "
                                       "rc < sizeof(*md->lmv) (%d < %d)\n",
                                        rc, (int)sizeof(*md->lmv));
@@ -1981,7 +1981,7 @@ out:
        return rc;
 }
 
-static struct kuc_hdr *changelog_kuc_hdr(char *buf, int len, int flags)
+static struct kuc_hdr *changelog_kuc_hdr(char *buf, size_t len, __u32 flags)
 {
        struct kuc_hdr *lh = (struct kuc_hdr *)buf;
 
@@ -2014,7 +2014,7 @@ static int changelog_kkuc_cb(const struct lu_env *env, struct llog_handle *llh,
        struct changelog_show           *cs = data;
        struct llog_changelog_rec       *rec = (struct llog_changelog_rec *)hdr;
        struct kuc_hdr                  *lh;
-       int                              len;
+       size_t                           len;
        int                              rc;
        ENTRY;
 
@@ -2047,7 +2047,7 @@ static int changelog_kkuc_cb(const struct lu_env *env, struct llog_handle *llh,
         memcpy(lh + 1, &rec->cr, len - sizeof(*lh));
 
         rc = libcfs_kkuc_msg_put(cs->cs_fp, lh);
-       CDEBUG(D_HSM, "kucmsg fp %p len %d rc %d\n", cs->cs_fp, len, rc);
+       CDEBUG(D_HSM, "kucmsg fp %p len %zu rc %d\n", cs->cs_fp, len, rc);
 
         RETURN(rc);
 }
@@ -2494,7 +2494,7 @@ static void lustre_swab_hai(struct hsm_action_item *h)
 static void lustre_swab_hal(struct hsm_action_list *h)
 {
        struct hsm_action_item  *hai;
-       int                      i;
+       __u32                    i;
 
        __swab32s(&h->hal_version);
        __swab32s(&h->hal_count);
@@ -2543,7 +2543,7 @@ static int mdc_ioc_hsm_ct_start(struct obd_export *exp,
  * @param val KUC message (kuc_hdr + hsm_action_list)
  * @param len total length of message
  */
-static int mdc_hsm_copytool_send(int len, void *val)
+static int mdc_hsm_copytool_send(size_t len, void *val)
 {
        struct kuc_hdr          *lh = (struct kuc_hdr *)val;
        struct hsm_action_list  *hal = (struct hsm_action_list *)(lh + 1);
@@ -2551,8 +2551,8 @@ static int mdc_hsm_copytool_send(int len, void *val)
        ENTRY;
 
        if (len < sizeof(*lh) + sizeof(*hal)) {
-               CERROR("Short HSM message %d < %d\n", len,
-                      (int) (sizeof(*lh) + sizeof(*hal)));
+               CERROR("Short HSM message %zu < %zu\n", len,
+                      sizeof(*lh) + sizeof(*hal));
                RETURN(-EPROTO);
        }
        if (lh->kuc_magic == __swab16(KUC_MAGIC)) {
@@ -2670,18 +2670,18 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
        int rc = -EINVAL;
 
        if (KEY_IS(KEY_MAX_EASIZE)) {
-               int mdsize, *max_easize;
+               __u32 mdsize, *max_easize;
 
                if (*vallen != sizeof(int))
                        RETURN(-EINVAL);
-               mdsize = *(int *)val;
+               mdsize = *(__u32 *)val;
                if (mdsize > exp->exp_obd->u.cli.cl_max_mds_easize)
                        exp->exp_obd->u.cli.cl_max_mds_easize = mdsize;
                max_easize = val;
                *max_easize = exp->exp_obd->u.cli.cl_max_mds_easize;
                RETURN(0);
        } else if (KEY_IS(KEY_DEFAULT_EASIZE)) {
-               int *default_easize;
+               __u32 *default_easize;
 
                if (*vallen != sizeof(int))
                        RETURN(-EINVAL);
@@ -2689,7 +2689,7 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
                *default_easize = exp->exp_obd->u.cli.cl_default_mds_easize;
                RETURN(0);
        } else if (KEY_IS(KEY_MAX_COOKIESIZE)) {
-               int mdsize, *max_cookiesize;
+               __u32 mdsize, *max_cookiesize;
 
                if (*vallen != sizeof(int))
                        RETURN(-EINVAL);
@@ -2700,7 +2700,7 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
                *max_cookiesize = exp->exp_obd->u.cli.cl_max_mds_cookiesize;
                RETURN(0);
        } else if (KEY_IS(KEY_DEFAULT_COOKIESIZE)) {
-               int *default_cookiesize;
+               __u32 *default_cookiesize;
 
                if (*vallen != sizeof(int))
                        RETURN(-EINVAL);
@@ -2718,7 +2718,7 @@ int mdc_get_info(const struct lu_env *env, struct obd_export *exp,
                 *data = imp->imp_connect_data;
                 RETURN(0);
         } else if (KEY_IS(KEY_TGT_COUNT)) {
-                *((int *)val) = 1;
+               *((__u32 *)val) = 1;
                 RETURN(0);
         }
 
@@ -2950,8 +2950,9 @@ err_rpc_lock:
  * a large number of stripes is possible.  If a larger reply buffer is
  * required it will be reallocated in the ptlrpc layer due to overflow.
  */
-static int mdc_init_ea_size(struct obd_export *exp, int easize,
-                           int def_easize, int cookiesize, int def_cookiesize)
+static int mdc_init_ea_size(struct obd_export *exp, __u32 easize,
+                           __u32 def_easize, __u32 cookiesize,
+                           __u32 def_cookiesize)
 {
        struct obd_device *obd = exp->exp_obd;
        struct client_obd *cli = &obd->u.cli;