backport gfs2_jadd: Fix static analysis warnings
This commit is contained in:
parent
c627ee6af6
commit
3354ba449c
56
0006-gfs2_jadd-Fix-static-analysis-warnings.patch
Normal file
56
0006-gfs2_jadd-Fix-static-analysis-warnings.patch
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
From 8a0b4b2183e05be4c92612b0a82ed64617e6a742 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andrew Price <anprice@redhat.com>
|
||||||
|
Date: Tue, 9 Jun 2020 15:24:28 +0100
|
||||||
|
Subject: [PATCH] gfs2_jadd: Fix static analysis warnings
|
||||||
|
|
||||||
|
Fix these warnings:
|
||||||
|
|
||||||
|
gfs2/mkfs/main_jadd.c:264:8: warning: Although the value stored to
|
||||||
|
'error' is used in the enclosing expression, the value is never actually
|
||||||
|
read from 'error'
|
||||||
|
gfs2/mkfs/main_jadd.c:514:15: warning: Assigned value is garbage or
|
||||||
|
undefined
|
||||||
|
|
||||||
|
Signed-off-by: Andrew Price <anprice@redhat.com>
|
||||||
|
---
|
||||||
|
gfs2/mkfs/main_jadd.c | 9 +++++----
|
||||||
|
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/gfs2/mkfs/main_jadd.c b/gfs2/mkfs/main_jadd.c
|
||||||
|
index ea89c96b..03134a61 100644
|
||||||
|
--- a/gfs2/mkfs/main_jadd.c
|
||||||
|
+++ b/gfs2/mkfs/main_jadd.c
|
||||||
|
@@ -241,7 +241,7 @@ static void print_results(struct jadd_opts *opts)
|
||||||
|
static int create_new_inode(struct jadd_opts *opts, uint64_t *addr)
|
||||||
|
{
|
||||||
|
char *name = opts->new_inode;
|
||||||
|
- int fd, error = 0;
|
||||||
|
+ int fd;
|
||||||
|
|
||||||
|
for (;;) {
|
||||||
|
fd = open(name, O_WRONLY | O_CREAT | O_EXCL | O_NOFOLLOW | O_CLOEXEC, 0600);
|
||||||
|
@@ -261,9 +261,10 @@ static int create_new_inode(struct jadd_opts *opts, uint64_t *addr)
|
||||||
|
if (addr != NULL) {
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
- if ((error = fstat(fd, &st))) {
|
||||||
|
+ if (fstat(fd, &st) == -1) {
|
||||||
|
perror("fstat");
|
||||||
|
- return close(fd);
|
||||||
|
+ close(fd);
|
||||||
|
+ return -1;
|
||||||
|
}
|
||||||
|
*addr = st.st_ino;
|
||||||
|
}
|
||||||
|
@@ -481,7 +482,7 @@ static int add_j(struct gfs2_sbd *sdp, struct jadd_opts *opts)
|
||||||
|
unsigned int x, blocks =
|
||||||
|
sdp->jsize << (20 - sdp->sd_sb.sb_bsize_shift);
|
||||||
|
struct gfs2_log_header lh;
|
||||||
|
- uint64_t seq = RANDOM(blocks), addr;
|
||||||
|
+ uint64_t seq = RANDOM(blocks), addr = 0;
|
||||||
|
off_t off = 0;
|
||||||
|
|
||||||
|
if ((fd = create_new_inode(opts, &addr)) < 0)
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
Name: gfs2-utils
|
Name: gfs2-utils
|
||||||
Version: 3.2.0
|
Version: 3.2.0
|
||||||
Release: 10
|
Release: 11
|
||||||
Summary: Global Filesystem Utilities
|
Summary: Global Filesystem Utilities
|
||||||
|
|
||||||
License: GPLv2+ and LGPLv2+
|
License: GPLv2+ and LGPLv2+
|
||||||
@ -12,6 +12,7 @@ Patch0002: 0002-libgfs2-Fix-gfs-2-_log_header-metadata-description.patch
|
|||||||
Patch0003: 0003-fsck.gfs2-Fix-segfault-in-build_and_check_metalist.patch
|
Patch0003: 0003-fsck.gfs2-Fix-segfault-in-build_and_check_metalist.patch
|
||||||
Patch0004: 0004-gfs2_jadd-Handle-out-of-space-issues.patch
|
Patch0004: 0004-gfs2_jadd-Handle-out-of-space-issues.patch
|
||||||
Patch0005: 0005--gfs2_jadd-error-handling-overhaul.patch
|
Patch0005: 0005--gfs2_jadd-error-handling-overhaul.patch
|
||||||
|
Patch0006: 0006-gfs2_jadd-Fix-static-analysis-warnings.patch
|
||||||
|
|
||||||
BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel
|
BuildRequires: ncurses-devel kernel-headers automake libtool zlib-devel gettext-devel
|
||||||
BuildRequires: bison flex libblkid-devel libuuid-devel check-devel
|
BuildRequires: bison flex libblkid-devel libuuid-devel check-devel
|
||||||
@ -57,6 +58,9 @@ make -C gfs2 install DESTDIR=%{buildroot}
|
|||||||
%exclude %{_mandir}/man8/gfs2_lockcapture.8.gz
|
%exclude %{_mandir}/man8/gfs2_lockcapture.8.gz
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 12 2023 liyuanyuan <liyuanyuan@xfusion.com> - 3.2.0-11
|
||||||
|
- gfs2_jadd: Fix static analysis warningS
|
||||||
|
|
||||||
* Fri Nov 24 2023 liyuanyuan <liyuanyuan@xfusion.com> - 3.2.0-10
|
* Fri Nov 24 2023 liyuanyuan <liyuanyuan@xfusion.com> - 3.2.0-10
|
||||||
- gfs2_jadd: error handling overhaul
|
- gfs2_jadd: error handling overhaul
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user