From: Li Zetao Date: Thu, 22 Aug 2024 13:39:04 +0000 (+0800) Subject: libceph: use min() to simplify code in ceph_dns_resolve_name() X-Git-Tag: v6.12-rc1~16^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ede0b1d30b82829d6bc7924be18c7ae09cb1eb33;p=thirdparty%2Fkernel%2Fstable.git libceph: use min() to simplify code in ceph_dns_resolve_name() When resolving name in ceph_dns_resolve_name(), the end address of name is determined by the minimum value of delim_p and colon_p. So using min() here is more in line with the context. Signed-off-by: Li Zetao Reviewed-by: Simon Horman Signed-off-by: Ilya Dryomov --- diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 3c8b78d9c4d1c..d1b5705dc0c64 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c @@ -1254,7 +1254,7 @@ static int ceph_dns_resolve_name(const char *name, size_t namelen, colon_p = memchr(name, ':', namelen); if (delim_p && colon_p) - end = delim_p < colon_p ? delim_p : colon_p; + end = min(delim_p, colon_p); else if (!delim_p && colon_p) end = colon_p; else {