Skip to contentSkip to conversation

Fix problem recognizing symlinks

DISCUSSION Dan Carpenter 2 participants 2 messages Sep 26, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hello Steve French,

The patch 2b20ac4fcd7b: "Fix problem recognizing symlinks" from Sep 25, 2014, leads to the following static checker warning:

	fs/cifs/smb1ops.c:589 cifs_query_path_info()
	warn: we tested 'rc' before and it was 'false'

fs/cifs/smb1ops.c
569

   570          if (!rc && (le32_to_cpu(data->Attributes) & ATTR_REPARSE)) {
                    ^^^
   571                  int tmprc;
   572                  int oplock = 0;
   573                  struct cifs_fid fid;
   574                  struct cifs_open_parms oparms;
   575  
   576                  oparms.tcon = tcon;
   577                  oparms.cifs_sb = cifs_sb;
   578                  oparms.desired_access = FILE_READ_ATTRIBUTES;
   579                  oparms.create_options = 0;
   580                  oparms.disposition = FILE_OPEN;
   581                  oparms.path = full_path;
   582                  oparms.fid = &fid;
   583                  oparms.reconnect = false;
   584  
   585                  /* Need to check if this is a symbolic link or not */
   586                  tmprc = CIFS_open(xid, &oparms, &oplock, NULL);
   587                  if (tmprc == -EOPNOTSUPP)
   588                          *symlink = true;
   589                  else if (rc == 0)
                                 ^^^^^^^

The patch adds this new always true condition. It's not clear what the intent was.

   590                          CIFSSMBClose(xid, tcon, fid.netfid);
   591          }

regards,
dan carpenter

#1 lore raw

That is already fixed in cifs-2.6.git for-next

Quoted 41 lines · Dan Carpenter

Hello Steve French,

The patch 2b20ac4fcd7b: "Fix problem recognizing symlinks" from Sep 25, 2014, leads to the following static checker warning:

fs/cifs/smb1ops.c:589 cifs_query_path_info()
warn: we tested 'rc' before and it was 'false'

fs/cifs/smb1ops.c
569

   570          if (!rc && (le32_to_cpu(data->Attributes) & ATTR_REPARSE)) {
                    ^^^
   571                  int tmprc;
   572                  int oplock = 0;
   573                  struct cifs_fid fid;
   574                  struct cifs_open_parms oparms;
   575
   576                  oparms.tcon = tcon;
   577                  oparms.cifs_sb = cifs_sb;
   578                  oparms.desired_access = FILE_READ_ATTRIBUTES;
   579                  oparms.create_options = 0;
   580                  oparms.disposition = FILE_OPEN;
   581                  oparms.path = full_path;
   582                  oparms.fid = &fid;
   583                  oparms.reconnect = false;
   584
   585                  /* Need to check if this is a symbolic link or not */
   586                  tmprc = CIFS_open(xid, &oparms, &oplock, NULL);
   587                  if (tmprc == -EOPNOTSUPP)
   588                          *symlink = true;
   589                  else if (rc == 0)
                                 ^^^^^^^

The patch adds this new always true condition. It's not clear what the intent was.

   590                          CIFSSMBClose(xid, tcon, fid.netfid);
   591          }

regards,
dan carpenter

Signature · 3 lines
Thanks,

Steve