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]
Message-ID: <CAH2r5mtEvkw-v6dr7KdxoA6kzhraEx06kosrYoD-p1kmkX7cgw@mail.gmail.com>
Date: Sat, 31 Aug 2024 23:43:20 -0500
From: Steve French <smfrench@...il.com>
To: Shen Lichuan <shenlichuan@...o.com>
Cc: sfrench@...ba.org, pc@...guebit.com, ronniesahlberg@...il.com, 
	sprasad@...rosoft.com, tom@...pey.com, bharathsm@...rosoft.com, 
	linux-cifs@...r.kernel.org, samba-technical@...ts.samba.org, 
	linux-kernel@...r.kernel.org, opensource.kernel@...o.com
Subject: Re: [PATCH v1] smb: client: Use min() macro

tentatively merged to cifs-2.6.git for-next-next (target for 6.12-rc)
pending additional review and testing

On Tue, Aug 27, 2024 at 3:54 AM Shen Lichuan <shenlichuan@...o.com> wrote:
>
> Use the min() macro to simplify the function and improve
> its readability.
>
> Signed-off-by: Shen Lichuan <shenlichuan@...o.com>
> ---
>  fs/smb/client/cifsacl.c   | 2 +-
>  fs/smb/client/smbdirect.c | 8 +++-----
>  2 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/fs/smb/client/cifsacl.c b/fs/smb/client/cifsacl.c
> index f5b6df82e857..2f9a1bb6e21c 100644
> --- a/fs/smb/client/cifsacl.c
> +++ b/fs/smb/client/cifsacl.c
> @@ -187,7 +187,7 @@ compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
>         /* compare all of the subauth values if any */
>         num_sat = ctsid->num_subauth;
>         num_saw = cwsid->num_subauth;
> -       num_subauth = num_sat < num_saw ? num_sat : num_saw;
> +       num_subauth = min(num_sat, num_saw);
>         if (num_subauth) {
>                 for (i = 0; i < num_subauth; ++i) {
>                         if (ctsid->sub_auth[i] != cwsid->sub_auth[i]) {
> diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c
> index 7bcc379014ca..f307122b59fe 100644
> --- a/fs/smb/client/smbdirect.c
> +++ b/fs/smb/client/smbdirect.c
> @@ -1584,11 +1584,9 @@ static struct smbd_connection *_smbd_get_connection(
>         memset(&conn_param, 0, sizeof(conn_param));
>         conn_param.initiator_depth = 0;
>
> -       conn_param.responder_resources =
> -               info->id->device->attrs.max_qp_rd_atom
> -                       < SMBD_CM_RESPONDER_RESOURCES ?
> -               info->id->device->attrs.max_qp_rd_atom :
> -               SMBD_CM_RESPONDER_RESOURCES;
> +       conn_param.responder_resources =
> +               min(info->id->device->attrs.max_qp_rd_atom,
> +                   SMBD_CM_RESPONDER_RESOURCES);
>         info->responder_resources = conn_param.responder_resources;
>         log_rdma_mr(INFO, "responder_resources=%d\n",
>                 info->responder_resources);
> --
> 2.17.1
>
>


-- 
Thanks,

Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ