2023-06-09 05:24:51

by Lu Hongfei

[permalink] [raw]
Subject: [PATCH] fs: smb: server: Replace the ternary conditional operator with min()

It would be better to replace the traditional ternary conditional
operator with min() in compare_sids.

Signed-off-by: Lu Hongfei <[email protected]>
---
fs/smb/server/smbacl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/smb/server/smbacl.c b/fs/smb/server/smbacl.c
index 0a5862a61c77..a93ae72fe4ef
--- a/fs/smb/server/smbacl.c
+++ b/fs/smb/server/smbacl.c
@@ -97,7 +97,7 @@ int compare_sids(const struct smb_sid *ctsid, const struct smb_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]) {
--
2.39.0



2023-06-10 15:07:49

by Namjae Jeon

[permalink] [raw]
Subject: Re: [PATCH] fs: smb: server: Replace the ternary conditional operator with min()

2023-06-09 14:06 GMT+09:00, Lu Hongfei <[email protected]>:
> It would be better to replace the traditional ternary conditional
> operator with min() in compare_sids.
>
> Signed-off-by: Lu Hongfei <[email protected]>
Acked-by: Namjae Jeon <[email protected]>

Thanks for your patch!