lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 8 Jan 2024 18:52:45 -0600
From: Steve French <smfrench@...il.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: Paulo Alcantara <pc@...guebit.com>, Ronnie Sahlberg <lsahlber@...hat.com>, 
	Shyam Prasad N <sprasad@...rosoft.com>, Tom Talpey <tom@...pey.com>, linux-cifs@...r.kernel.org, 
	samba-technical@...ts.samba.org, linux-kernel@...r.kernel.org, 
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/3] cifs: delete unnecessary NULL checks in cifs_chan_update_iface()

merged into cifs-2.6.git for-next, still reviewing the other two

On Mon, Jan 8, 2024 at 3:08 AM Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> We return early if "iface" is NULL so there is no need to check here.
> Delete those checks.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  fs/smb/client/sess.c | 26 +++++++++++---------------
>  1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/fs/smb/client/sess.c b/fs/smb/client/sess.c
> index a16e175731eb..775c6a4a2f4b 100644
> --- a/fs/smb/client/sess.c
> +++ b/fs/smb/client/sess.c
> @@ -467,27 +467,23 @@ cifs_chan_update_iface(struct cifs_ses *ses, struct TCP_Server_Info *server)
>                 kref_put(&old_iface->refcount, release_iface);
>         } else if (!chan_index) {
>                 /* special case: update interface for primary channel */
> -               if (iface) {
> -                       cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
> -                                &iface->sockaddr);
> -                       iface->num_channels++;
> -                       iface->weight_fulfilled++;
> -               }
> +               cifs_dbg(FYI, "referencing primary channel iface: %pIS\n",
> +                        &iface->sockaddr);
> +               iface->num_channels++;
> +               iface->weight_fulfilled++;
>         }
>         spin_unlock(&ses->iface_lock);
>
> -       if (iface) {
> -               spin_lock(&ses->chan_lock);
> -               chan_index = cifs_ses_get_chan_index(ses, server);
> -               if (chan_index == CIFS_INVAL_CHAN_INDEX) {
> -                       spin_unlock(&ses->chan_lock);
> -                       return 0;
> -               }
> -
> -               ses->chans[chan_index].iface = iface;
> +       spin_lock(&ses->chan_lock);
> +       chan_index = cifs_ses_get_chan_index(ses, server);
> +       if (chan_index == CIFS_INVAL_CHAN_INDEX) {
>                 spin_unlock(&ses->chan_lock);
> +               return 0;
>         }
>
> +       ses->chans[chan_index].iface = iface;
> +       spin_unlock(&ses->chan_lock);
> +
>         return rc;
>  }
>
> --
> 2.42.0
>
>


-- 
Thanks,

Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ