[PATCH net-next 3/8] net/ipv4: Use min() to simplify the code
Hongbo Li
lihongbo22 at huawei.com
Sat Aug 24 00:40:28 PDT 2024
The following Coccinelle/coccicheck warning reported by
minmax.cocci:
WARNING opportunity for min()
Let's use min() to simplify the code and fix the warning.
Signed-off-by: Hongbo Li <lihongbo22 at huawei.com>
---
net/ipv4/ip_sockglue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index cf377377b52d..f35aba4c3b0e 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -282,7 +282,7 @@ int ip_cmsg_send(struct sock *sk, struct msghdr *msg, struct ipcm_cookie *ipc,
/* Our caller is responsible for freeing ipc->opt */
err = ip_options_get(net, &ipc->opt,
KERNEL_SOCKPTR(CMSG_DATA(cmsg)),
- err < 40 ? err : 40);
+ min(40, err));
if (err)
return err;
break;
--
2.34.1
More information about the linux-afs
mailing list