Whamcloud - gitweb
LU-13673 misc: quiet compiler warning on armv7l 27/38927/6
authorAndreas Dilger <adilger@whamcloud.com>
Fri, 12 Jun 2020 21:16:09 +0000 (15:16 -0600)
committerOleg Drokin <green@whamcloud.com>
Sat, 4 Jul 2020 03:04:25 +0000 (03:04 +0000)
Add AM_CFLAGS when building lfs.c and lfs_project.c.

Avoid overflow in jobid_get_from_environ() and lu_prandom_u64_max().

Quiet printk() warning for mismatched type of size_t variables
by using %z modifier for those variables.

Fixes: 742897a967cf ("LU-13274 uapi: make lnet UAPI headers C99 compliant")
Fixes: df21a3b9eb01 ("LU-12790 obdclass: print jobid error message properly")
Fixes: 645b72c5c058 ("LU-12495 obdclass: generate random u64 max correctly")
Test-Parameters: trivial
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: Ib424497d1543fd7840d630facf3210b6fa1344c7
Reviewed-on: https://review.whamcloud.com/38927
Reviewed-by: James Simmons <jsimmons@infradead.org>
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Lai Siyao <lai.siyao@whamcloud.com>
Reviewed-by: Yang Sheng <ys@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/vvp_io.c
lustre/obdclass/jobid.c
lustre/obdclass/lu_tgt_descs.c
lustre/utils/Makefile.am

index 5fb6e13..8d79586 100644 (file)
@@ -829,7 +829,7 @@ static int vvp_io_read_start(const struct lu_env *env,
                GOTO(out, result);
 
        LU_OBJECT_HEADER(D_INODE, env, &obj->co_lu,
-                        "Read ino %lu, %lu bytes, offset %lld, size %llu\n",
+                        "Read ino %lu, %zu bytes, offset %lld, size %llu\n",
                         inode->i_ino, cnt, pos, i_size_read(inode));
 
        /* turn off the kernel's read-ahead */
@@ -1309,9 +1309,8 @@ static int vvp_io_write_start(const struct lu_env *env,
                }
        }
        if (vio->vui_iocb->ki_pos != (pos + io->ci_nob - nob)) {
-               CDEBUG(D_VFSTRACE, "%s: write position mismatch: "
-                      "ki_pos %lld vs. pos %lld, written %ld, commit %ld "
-                      "rc %ld\n",
+               CDEBUG(D_VFSTRACE,
+                      "%s: write position mismatch: ki_pos %lld vs. pos %lld, written %zd, commit %zd: rc = %zd\n",
                       file_dentry(file)->d_name.name,
                       vio->vui_iocb->ki_pos, pos + io->ci_nob - nob,
                       written, io->ci_nob - nob, result);
index 868f19d..939fec1 100644 (file)
@@ -238,7 +238,7 @@ int jobid_get_from_environ(char *jobid_var, char *jobid, int *jobid_len)
                if (unlikely(ktime_to_ns(printed) == 0 ||
                             ktime_after(ktime_get(),
                                         ktime_add_ns(printed,
-                                                     3600*24*NSEC_PER_SEC)))) {
+                                            3600ULL * 24 * NSEC_PER_SEC)))) {
                        LCONSOLE_WARN("jobid: '%s' value too large (%d)\n",
                                      obd_jobid_var, *jobid_len);
                        printed = ktime_get();
index 22d79a1..f15e18b 100644 (file)
@@ -64,7 +64,7 @@ u64 lu_prandom_u64_max(u64 ep_ro)
                 * 32 bits (truncated to the upper limit, if needed)
                 */
                if (ep_ro > 0xffffffffULL)
-                       rand = prandom_u32_max((u32)(ep_ro >> 32)) << 32;
+                       rand = (u64)prandom_u32_max((u32)(ep_ro >> 32)) << 32;
 
                if (rand == (ep_ro & 0xffffffff00000000ULL))
                        rand |= prandom_u32_max((u32)ep_ro);
index 9e3c8a9..0f87553 100644 (file)
@@ -68,7 +68,7 @@ lctl_LDADD :=  liblustreapi.la $(PTHREAD_LIBS) -lyaml
 lctl_DEPENDENCIES := liblustreapi.la
 
 lfs_SOURCES = lfs.c lfs_project.c lfs_project.h
-lfs_CFLAGS := -fPIC -I $(top_builddir)/lnet/utils
+lfs_CFLAGS := -fPIC $(AM_CFLAGS) -I $(top_builddir)/lnet/utils
 lfs_LDADD := liblustreapi.la -lz
 lfs_LDADD += $(top_builddir)/lnet/utils/lnetconfig/liblnetconfig.la
 lfs_DEPENDENCIES := liblustreapi.la