Re: [cifs:for-next-next 13/13] fs/smb/client/fs_context.c:1466 smb3_fs_context_parse_param() warn: statement has no effect 22

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



buggy patch removed

On Mon, Jan 6, 2025 at 3:24 AM Dan Carpenter <dan.carpenter@xxxxxxxxxx> wrote:
>
> tree:   git://git.samba.org/sfrench/cifs-2.6.git for-next-next
> head:   8f97b4a68ea216bad142a5391e30fa63c8efce30
> commit: 8f97b4a68ea216bad142a5391e30fa63c8efce30 [13/13] smb3 client: minor cleanup of username parsing on mount
> config: x86_64-randconfig-161-20241220 (https://download.01.org/0day-ci/archive/20241222/202412220354.ZyCvciEy-lkp@xxxxxxxxx/config)
> compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@xxxxxxxxx>
> | Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> | Closes: https://lore.kernel.org/r/202412220354.ZyCvciEy-lkp@xxxxxxxxx/
>
> smatch warnings:
> fs/smb/client/fs_context.c:1466 smb3_fs_context_parse_param() warn: statement has no effect 22
>
> vim +1466 fs/smb/client/fs_context.c
>
> 8f97b4a68ea216b fs/smb/client/fs_context.c Steve French     2024-10-23  1452            /* if first character is null, then anonymous auth */
> 8f97b4a68ea216b fs/smb/client/fs_context.c Steve French     2024-10-23  1453            if (*(param->string) == 0) {
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1454                    /* null user, ie. anonymous authentication */
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1455                    ctx->nullauth = 1;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1456                    break;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1457            }
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1458
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1459            if (strnlen(param->string, CIFS_MAX_USERNAME_LEN) >
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1460                CIFS_MAX_USERNAME_LEN) {
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1461                    pr_warn("username too long\n");
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1462                    goto cifs_parse_mount_err;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1463            }
> 8f97b4a68ea216b fs/smb/client/fs_context.c Steve French     2024-10-23  1464            ctx->username = param->string, GFP_KERNEL;
> 8f97b4a68ea216b fs/smb/client/fs_context.c Steve French     2024-10-23  1465            /* streal string from caller, but set to NULL so caller doesn't free */
>
> Typo: "streal" should be "steal".
>
> 8f97b4a68ea216b fs/smb/client/fs_context.c Steve French     2024-10-23 @1466            param->string == NULL;
>
>
> It should be = instead of ==.  It's surprising this compiles...
>
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1467            break;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1468    case Opt_pass:
> a4e430c8c8ba96b fs/cifs/fs_context.c       Enzo Matsumiya   2022-09-20  1469            kfree_sensitive(ctx->password);
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1470            ctx->password = NULL;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1471            if (strlen(param->string) == 0)
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1472                    break;
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1473
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1474            ctx->password = kstrdup(param->string, GFP_KERNEL);
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1475            if (ctx->password == NULL) {
> 24fedddc954ed16 fs/cifs/fs_context.c       Aurelien Aptel   2021-03-01  1476                    cifs_errorf(fc, "OOM when copying password string\n");
> 24e0a1eff9e2b98 fs/cifs/fs_context.c       Ronnie Sahlberg  2020-12-10  1477                    goto cifs_parse_mount_err;
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
>
>


-- 
Thanks,

Steve





[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux