afs_fetchstore: avoid use of uninitialized variable
authorBenjamin Kaduk <kaduk@mit.edu>
Fri, 10 Jan 2014 03:42:26 +0000 (22:42 -0500)
committerDerrick Brashear <shadow@your-file-system.com>
Fri, 17 Jan 2014 18:38:05 +0000 (10:38 -0800)
rxfs_fetchInit() attempts to do a 64-bit RPC first, but falls back
to the 32-bit StartRXAFS_FetchData() if the server appears to not
support the 64-bit RPCs.

We correctly did not read a length from the call if the FetchData
RPC(s) failed, but proceeded to assign from the 'length' local
variable into the 'alength' output variable unconditionally later on.

Instead of blindly continuing on, jump to the error-handling part of
the routine when we cannot read a length from the call.  This has the
side effect of skipping an afs_Trace3() point in the error case.

Change-Id: I4840d5c692c61630c68e97b5e88f9460abade19e
Reviewed-on: http://gerrit.openafs.org/10694
Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

src/afs/afs_fetchstore.c

index 35c357a..8db6697 100644 (file)
@@ -974,7 +974,9 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn,
            afs_serverSetNo64Bit(tc);
            v->hasNo64bit = 1;
        }
-       if (!code) {
+       if (code) {
+           goto err;
+       } else {
            RX_AFS_GUNLOCK();
            bytes = rx_Read(v->call, (char *)&length, sizeof(afs_int32));
            RX_AFS_GLOCK();
@@ -1032,6 +1034,7 @@ rxfs_fetchInit(struct afs_conn *tc, struct rx_connection *rxconn,
        code = EIO;
     }
 
+err:
     if (!code && code1)
        code = code1;