Skip to content

Commit cc5d4df

Browse files
rmtfs: Fix a couple of possible uninitialized variables usage
GCC version 13.2.1 20231205 complains about the following: cc -Wall -g -O2 -c -o storage.o storage.c In function ‘rmtfs_iovec’, inlined from ‘handle_rmtfs’ at rmtfs.c:403:4: rmtfs.c:224:12: warning: ‘is_write’ may be used uninitialized [-Wmaybe-uninitialized] 224 | if (is_write) | ^ rmtfs.c: In function ‘handle_rmtfs’: rmtfs.c:158:17: note: ‘is_write’ was declared here 158 | uint8_t is_write; | ^ In function ‘rmtfs_iovec’, inlined from ‘handle_rmtfs’ at rmtfs.c:403:4: rmtfs.c:225:17: warning: ‘rmtfd’ may be used uninitialized [-Wmaybe-uninitialized] 225 | storage_sync(rmtfd); | ^~~~~~~~~~~~~~~~~~~ rmtfs.c: In function ‘handle_rmtfs’: rmtfs.c:154:23: note: ‘rmtfd’ was declared here 154 | struct rmtfd *rmtfd; | ^~~~~ Signed-off-by: Javier Martinez Canillas <[email protected]>
1 parent 7a5ae7e commit cc5d4df

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rmtfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,11 @@ static void rmtfs_iovec(int sock, struct qrtr_packet *pkt)
151151
struct rmtfs_iovec_resp resp = {};
152152
struct rmtfs_iovec_req req = {};
153153
DEFINE_QRTR_PACKET(resp_buf, 256);
154-
struct rmtfd *rmtfd;
154+
struct rmtfd *rmtfd = NULL;
155155
uint32_t caller_id = 0;
156156
size_t num_entries = 0;
157157
off_t sector_base;
158-
uint8_t is_write;
158+
uint8_t is_write = 0;
159159
off_t phys_base;
160160
uint8_t force = 0;
161161
unsigned txn;

0 commit comments

Comments
 (0)