Skip to contentSkip to conversation

/fs/cifs/cifssmb.c (2.6.35.5): Simple pointer initialization

PATCH In review Poyo VL 2 participants 2 messages Sep 26, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Poyo VL

author
#0 lore raw

PATCH 1/1 /fs/cifs/cifssmb.c (2.6.35.5): Simple pointer initialization

When I tried to compile the kernel (make allyesconfig) I got the following ugly warning:
fs/cifs/cifssmb.c: In function ‘CIFSSMBGetCIFSACL’:
fs/cifs/cifssmb.c:3082: warning: ‘pdata’ may be used uninitialized in this function
The pdata pointer is prctically initialized in line 3086 and it is used in line 3122, but the compiler can't be sure that pdata will be used initialized so it throws that ugly warning. Just initializing *pdata with NULL will get rid off that warning.
Patch downer. I also attached it because someone told me that there are problems with Yahoo! Mail, it trims spaces or tabs...

---

fs/cifs/cifssmb.c 2010-09-26 13:05:45.281241095 +0300 renamed from fs/cifs/cifssmb.c 2010-09-20 23:59:09.000000000 +0300 +1 -1
@@ -3079,7 +3079,7 @@ CIFSSMBGetCIFSACL(const int xid, struct
         __u32 parm_len;
         __u32 acl_len;
         struct smb_com_ntransact_rsp *pSMBr;
-        char *pdata;
+        char *pdata = NULL;
 
 /* validate_nttransact */
         rc = validate_ntransact(iov[0].iov_base, (char **)&parm,
fs/cifs/cifssmb.c +1 -1
@@ -3079,7 +3079,7 @@ CIFSSMBGetCIFSACL(const int xid, struct
 		__u32 parm_len;
 		__u32 acl_len;
 		struct smb_com_ntransact_rsp *pSMBr;
-		char *pdata;
+		char *pdata = NULL;
 
 /* validate_nttransact */
 		rc = validate_ntransact(iov[0].iov_base, (char **)&parm,

A message that is not in the archive (sent off-list or not yet received): 945403.85622.qm-K0ZMcrTUAwnrNpU5RS+xBlZ8N9CAUha/[email protected]

#2 lore raw

Seems that it makes it more confusing? - if null were a valid value for pdata we would need to check for this later in the function before the memcpy

It didn't throw that error on my gcc version - is your gcc older or do you use different compile options or different arch?

Quoted 29 lines · Poyo VL

When I tried to compile the kernel (make allyesconfig) I got the following ugly warning:
fs/cifs/cifssmb.c: In function ‘CIFSSMBGetCIFSACL’:
fs/cifs/cifssmb.c:3082: warning: ‘pdata’ may be used uninitialized in this function
The pdata pointer is prctically initialized in line 3086 and it is used in line 3122, but the compiler can't be sure that pdata will be used initialized so it throws that ugly warning. Just initializing *pdata with NULL will get rid off that warning.
Patch downer. I also attached it because someone told me that there are problems with Yahoo! Mail, it trims spaces or tabs...

---

fs/cifs/cifssmb.c    2010-09-26 13:05:45.281241095 +0300 renamed from fs/cifs/cifssmb.c    2010-09-20 23:59:09.000000000 +0300 +1 -1
@@ -3079,7 +3079,7 @@ CIFSSMBGetCIFSACL(const int xid, struct
         __u32 parm_len;
         __u32 acl_len;
         struct smb_com_ntransact_rsp *pSMBr;
-        char *pdata;
+        char *pdata = NULL;
 
  /* validate_nttransact */
         rc = validate_ntransact(iov[0].iov_base, (char **)&parm,
Signature · 3 lines
Thanks,

Steve