* [PATCH RFC] nfs: initialize timeout variable in nfs4_proc_setclientid_confirm
@ 2008-06-24 17:25 Benny Halevy
2008-06-24 18:50 ` Trond Myklebust
0 siblings, 1 reply; 2+ messages in thread
From: Benny Halevy @ 2008-06-24 17:25 UTC (permalink / raw)
To: Trond Myklebust; +Cc: NFS list
gcc (4.3.0) rightfully warns about this:
/usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/nfs/nfs4proc.c: In =
function =91nfs4_proc_setclientid_confirm=92:
/usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/nfs/nfs4proc.c:2936=
: warning: =91timeout=92 may be used uninitialized in this function
nfs4_delay that's passed a pointer to 'timeout' is looking at its value
and sets it up to some value in the range: NFS4_POLL_RETRY_MIN..NFS4_PO=
LL_RETRY_MAX
if (*timeout <=3D 0)
*timeout =3D NFS4_POLL_RETRY_MIN;
if (*timeout > NFS4_POLL_RETRY_MAX)
*timeout =3D NFS4_POLL_RETRY_MAX;
Therefore it will end up set to some sane, though rather indeterministi=
c, value.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
---
Trond, this patch merely initializes timeout to 0 which will
result in it set eventually to NFS4_POLL_RETRY_MIN.
Is this appropriate?
Benny
fs/nfs/nfs4proc.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1293e0a..39981b6 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2933,7 +2933,7 @@ static int _nfs4_proc_setclientid_confirm(struct =
nfs_client *clp, struct rpc_cre
=20
int nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct rpc_c=
red *cred)
{
- long timeout;
+ long timeout =3D 0;
int err;
do {
err =3D _nfs4_proc_setclientid_confirm(clp, cred);
--=20
1.5.6.GIT
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH RFC] nfs: initialize timeout variable in nfs4_proc_setclientid_confirm
2008-06-24 17:25 [PATCH RFC] nfs: initialize timeout variable in nfs4_proc_setclientid_confirm Benny Halevy
@ 2008-06-24 18:50 ` Trond Myklebust
0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2008-06-24 18:50 UTC (permalink / raw)
To: Benny Halevy; +Cc: NFS list
On Tue, 2008-06-24 at 20:25 +0300, Benny Halevy wrote:
> gcc (4.3.0) rightfully warns about this:
> /usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/nfs/nfs4proc.c: I=
n function =E2=80=98nfs4_proc_setclientid_confirm=E2=80=99:
> /usr0/export/dev/bhalevy/git/linux-pnfs-bh-nfs41/fs/nfs/nfs4proc.c:29=
36: warning: =E2=80=98timeout=E2=80=99 may be used uninitialized in thi=
s function
>=20
> nfs4_delay that's passed a pointer to 'timeout' is looking at its val=
ue
> and sets it up to some value in the range: NFS4_POLL_RETRY_MIN..NFS4_=
POLL_RETRY_MAX
> if (*timeout <=3D 0)
> *timeout =3D NFS4_POLL_RETRY_MIN;
> if (*timeout > NFS4_POLL_RETRY_MAX)
> *timeout =3D NFS4_POLL_RETRY_MAX;
>=20
> Therefore it will end up set to some sane, though rather indeterminis=
tic, value.
>=20
> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
> ---
>=20
> Trond, this patch merely initializes timeout to 0 which will
> result in it set eventually to NFS4_POLL_RETRY_MIN.
> Is this appropriate?
ACK. Since the existing will always return sane values, and nobody has
complained yet, I'll queue this up for 2.6.27 rather than pushing it as
a hotfix.
Thanks!
Trond
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-24 18:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-24 17:25 [PATCH RFC] nfs: initialize timeout variable in nfs4_proc_setclientid_confirm Benny Halevy
2008-06-24 18:50 ` Trond Myklebust
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox