From: Jian Yu Date: Tue, 1 Aug 2023 08:09:25 +0000 (-0700) Subject: LU-16980 build: fix gcc-12 [-Werror=address] error X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e0760110fd89f85e1f7b30f00054bb51e580031c;p=fs%2Flustre-release.git LU-16980 build: fix gcc-12 [-Werror=address] error 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 Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/51829 Tested-by: Andreas Dilger Tested-by: jenkins Reviewed-by: Andreas Dilger --- diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 022845f..204072d 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -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; diff --git a/lustre/tests/kernel/kcompr.c b/lustre/tests/kernel/kcompr.c index b25c446..156a518 100644 --- a/lustre/tests/kernel/kcompr.c +++ b/lustre/tests/kernel/kcompr.c @@ -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; diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index 6f69bce..9fdb5a7 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -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)) {