SHA256
1
0
forked from pool/openafs
openafs/6b20756.diff
Christof Hanke cfa65eea8c Accepting request 1170220 from home:hauky:branches:filesystems
- update to openafs-1.8.11
- apply upstream patches for kernel 6.8
  * 056a7a8.diff
  * 05ac614.diff
  * 073adec.diff
  * 0d9f6cf.diff
  * 0e983a9.diff
  * 112fb94.diff
  * 1e1bf8e.diff
  * 2056ce8.diff
  * 5312d06.diff
  * 67e48c8.diff
  * 6b20756.diff
  * 743d72f.diff
  * 7cae97b.diff
  * 81b910a.diff
  * 87ab04a.diff
  * 9f052c1.diff
  * a14a9ad.diff
  * a87845d.diff
  * aae8b00.diff
  * b77b304.diff
  * d1c89ac.diff
  * d9f3a2c.diff
  * db91384.diff
  * dffd0e1.diff
  * e0f425a.diff
  * e157f8f.diff
  * e428053.diff
  * ef7b8c5.diff
  * f5bafb0.diff
  * fca6fd9.diff

OBS-URL: https://build.opensuse.org/request/show/1170220
OBS-URL: https://build.opensuse.org/package/show/filesystems/openafs?expand=0&rev=123
2024-04-26 04:08:22 +00:00

76 lines
2.8 KiB
Diff

From 6b207567af7244a4fc6c314fdc815aa14c4eae09 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 09 Feb 2024 09:01:33 -0700
Subject: [PATCH] afs: fix 'ops' variable may be used uninitialized
When the function rxfs_storeInit() has the static attribute, gcc flags
the variable 'ops' as possibly uninitialized.
In function 'afs_CacheStoreDCaches',
inlined from 'afs_CacheStoreVCache' at
.../src/afs/afs_fetchstore.c:630:14:
.../afs/afs_fetchstore.c:535:17: error: 'ops' may be used
uninitialized [-Werror=maybe-uninitialized]
535 | code = (*ops->destroy)(&rock, code);
| ~^~~~~~~~~~~~~~
...src/afs/afs_fetchstore.c: In function 'afs_CacheStoreVCache':
...src/afs/afs_fetchstore.c:567:22: note: 'ops' was declared here
567 | struct storeOps *ops;
| ^~~
cc1: all warnings being treated as errors
This is a false positive report by the gcc compiler.
The function rxfs_storeInit() returns a 0 only when it has successfully
assigned a value to the ops variable, and afs_CacheStoreDcaches() is
only called if the return value from rxfs_storeInit() is 0.
The ops variable is only used within a block that is within a for loop,
which could leave a stray value if the variable isn't initialized within
that loop.
Assigning a NULL to ops is sufficient to avoid the compiler error, and
relocating the declaration of the ops variable into the block where it
is actually used ensures that it's always initialized before its use
within the loop.
Clean up whitespace in the statement that follows the new location for
the ops variable.
Note, this commit is being added before a commit that adds the static
attribute to the rxfs_storeInit() function which also "fixes" the
compiler error (see: afs: Add static attribute to internal functions).
Reviewed-on: https://gerrit.openafs.org/15630
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 36e4c02ff27b9d66755b9544778896b9b1e5c391)
Change-Id: I9d8a07e576c6bf889f8f182c6fc0d34dc997c004
---
diff --git a/src/afs/afs_fetchstore.c b/src/afs/afs_fetchstore.c
index 7b35b8f..63b370d 100644
--- a/src/afs/afs_fetchstore.c
+++ b/src/afs/afs_fetchstore.c
@@ -564,7 +564,6 @@
afs_hyper_t *anewDV, afs_size_t *amaxStoredLength)
{
afs_int32 code = 0;
- struct storeOps *ops;
void * rock = NULL;
unsigned int i, j;
@@ -619,7 +618,8 @@
ICL_HANDLE_OFFSET(length));
do {
- tc = afs_Conn(&avc->f.fid, areq, 0, &rxconn);
+ struct storeOps *ops = NULL;
+ tc = afs_Conn(&avc->f.fid, areq, 0, &rxconn);
#ifdef AFS_64BIT_CLIENT
restart: