From patchwork Thu Aug 22 13:39:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Zetao X-Patchwork-Id: 821392 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6FF171CBE97; Thu, 22 Aug 2024 13:31:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724333500; cv=none; b=daQaW5MAR3JdW8Izu21Zp3zv/Qur1/SbjnVEt+uXM4qBbGTlJAhAD5Agjx12X7M+3PfIB/Ck1iBmfmu/OhPo9SX1C6PDA5CWFm45erAOBVmk43GcuzR2pO2b5tsFgDyROi97Qu4S6wI3ZwjxXSBvuslvmfFhygvIF4c/giMtsqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724333500; c=relaxed/simple; bh=t7BKP1fJyf+XGyVjS1hmdmpmT50V/P9F1DFki6pafgo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=H9s4eO7U1UmnRDIz5jShGI+wxWmYLVvT9fU7KKYXEo+RQLp26qLpr6iGU2/6DCHSVi9muZy5jwcUKZkL7WTLihiXg8keNxwvifE4iBYQSU5P2vVfHagk1xHIXPki+WF7NGHd7Iv2cSiGDIORA8mr1HSfAnuPMbYG9V5DfJWFQZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WqPFB2klbzhY9H; Thu, 22 Aug 2024 21:29:34 +0800 (CST) Received: from kwepemd500012.china.huawei.com (unknown [7.221.188.25]) by mail.maildlp.com (Postfix) with ESMTPS id 716121800FF; Thu, 22 Aug 2024 21:31:35 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemd500012.china.huawei.com (7.221.188.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1258.34; Thu, 22 Aug 2024 21:31:34 +0800 From: Li Zetao To: , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: , , , , Subject: [PATCH net-next 4/8] libceph: use min() to simplify the code Date: Thu, 22 Aug 2024 21:39:04 +0800 Message-ID: <20240822133908.1042240-5-lizetao1@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240822133908.1042240-1-lizetao1@huawei.com> References: <20240822133908.1042240-1-lizetao1@huawei.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemd500012.china.huawei.com (7.221.188.25) 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 Acked-by: Ilya Dryomov --- net/ceph/messenger.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 {