summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zetao <lizetao1@huawei.com>2024-08-22 21:39:04 +0800
committerIlya Dryomov <idryomov@gmail.com>2024-08-27 09:30:16 +0200
commitede0b1d30b82829d6bc7924be18c7ae09cb1eb33 (patch)
treeaf52a809f33c35e7d2886f439435f4bbd99c6501
parent2015716adbd9cac8505ed461f5f330e832be0c84 (diff)
downloadlinux-ede0b1d30b82829d6bc7924be18c7ae09cb1eb33.tar.gz
linux-ede0b1d30b82829d6bc7924be18c7ae09cb1eb33.tar.bz2
linux-ede0b1d30b82829d6bc7924be18c7ae09cb1eb33.zip
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 <lizetao1@huawei.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
-rw-r--r--net/ceph/messenger.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index 3c8b78d9c4d1..d1b5705dc0c6 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 {