Whamcloud - gitweb
LU-16980 build: fix gcc-12 [-Werror=address] error
authorJian Yu <yujian@whamcloud.com>
Tue, 1 Aug 2023 08:09:25 +0000 (01:09 -0700)
committerAndreas Dilger <adilger@whamcloud.com>
Tue, 1 Aug 2023 22:04:19 +0000 (22:04 +0000)
This patch fixes the following [-Werror=address] error
detected by gcc 12 and other errors caused by incomplete
porting in commit 1ef38b1258f1 to b_es6_0:

lustre/utils/obd.c: In function 'llog_search_pool_cb':
lustre/utils/obd.c:3816:28: error: the comparison will always evaluate
as 'true' for the address of 'lpd_ostname' will never be NULL
 3816 |       } else if (lpd->lpd_ostname && lpd->lpd_ostname[0]) {
      |                  ^~~
obd.c:3747:14: note: 'lpd_ostname' declared here
 3747 |       char lpd_ostname[MAX_OBD_NAME + 1];
      |            ^~~~~~~~~~~

lustre/tests/kernel/kcompr.c: In function 'fill_input_with_rand':
lustre/tests/kernel/kcompr.c:144:41: error: implicit declaration of
function 'prandom_u32_max'; did you mean 'prandom_u32_state'?
  144 |       p += sizeof(randbuf2) + prandom_u32_max(1 << 13);
      |                               ^~~~~~~~~~~~~~~
      |                               prandom_u32_state

lustre/llite/file.c: In function 'll_set_acl':
lustre/llite/file.c:5900:43: error: 'inode' undeclared
 5900 |       struct ll_sb_info *sbi = ll_i2sbi(inode);
      |                                         ^~~~~

Fixes: 1ef38b1258f1 ("LU-16594 build: get_random_u32_below, get_acl with dentry")
Change-Id: I9206fa169880ae16e192d17c8f144ed3b83c65a3
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51829
Tested-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
lustre/llite/file.c
lustre/tests/kernel/kcompr.c
lustre/utils/obd.c

index 022845f..204072d 100644 (file)
@@ -5897,6 +5897,9 @@ int ll_set_acl(struct mnt_idmap *map,
 #endif
               struct posix_acl *acl, int type)
 {
+#ifdef HAVE_ACL_WITH_DENTRY
+       struct inode *inode = dentry->d_inode;
+#endif
        struct ll_sb_info *sbi = ll_i2sbi(inode);
        struct ptlrpc_request *req = NULL;
        const char *name = NULL;
index b25c446..156a518 100644 (file)
@@ -141,7 +141,7 @@ int fill_input_with_rand(struct page *page, size_t count)
        while (p + sizeof(randbuf2) - (char *)pageaddr < count) {
                get_random_bytes(randbuf2, sizeof(randbuf2));
                memcpy(p, randbuf2, sizeof(randbuf2));
-               p += sizeof(randbuf2) + prandom_u32_max(1 << 13);
+               p += sizeof(randbuf2) + get_random_u32_below(1 << 13);
        }
        kunmap(page);
        return count;
index 6f69bce..9fdb5a7 100644 (file)
@@ -3813,7 +3813,7 @@ static int llog_search_pool_cb(const char *record, void *data)
                         */
                        if (strstr(record, add_pool))
                                lpd->lpd_ost_num++;
-               } else if (lpd->lpd_ostname && lpd->lpd_ostname[0]) {
+               } else if (lpd->lpd_ostname[0] != '\0') {
                        if (strstr(record, lpd->lpd_ostname)) {
                                lpd->lpd_pool_exists = true;
                                if (strstr(record, add_pool)) {