From nobody Mon Jun 8 04:14:53 2026 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 E82307262A for ; Tue, 2 Jun 2026 16:08:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780416527; cv=none; b=tkAz28rby9rxchWvXsgWqohoaFBGGmCOTLmVPPK2i733K6hE2zdyD6BoC+LzZgGaQ57l7hmvAoCjZoP5pAucmzwE2M8t/d7V0K0TuE0iygKpMOfqNBBIMoVbPa8Ybs2FmdRT5A+TAtiRV5jTkfsAPHNHMsgvfjCQDMfHfuiDoOY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780416527; c=relaxed/simple; bh=jHEP54/xzr6y+gurc767XySok3MRWRWSy1e3YUVbHS4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ul6tlAXAYphPoMZVPr10Okh9HCjyCata9d4lAmb8aXyrCygy0T4cLfRjdCqjftPdVLO/SOoTmw/O5a3CtTEkBxv5WbU1jLma+hU2+gaOpEry/sXy6vI+fQbcv+2eyG8W4jNBdf4JgpGulTDKbo/Y0b0BwaG+gw5c3flkmc52TUg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=QOJhp52C; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="QOJhp52C" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1780416521; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=k1UMyfTQNPyzDLAJ0fEbSsx0QHZQZ2I3LxkBnFOQYn8=; b=QOJhp52CfiUomFL47IChHkBJcLybYekyLGFQvxWIY5feSvk6q9LxLT5Tg6aiKSCow+Qu01 ga0KBwVixgeuxzsYUKEmqFGNmz87eImNMuihJduih3S69c6WLcJ0PClLt4IWv4zg8wM5LX drjVkDxI1RGkYzPDwf4XQ4We6avlMBI= From: Thorsten Blum To: Jens Axboe , Kees Cook , Josh Law Cc: Thorsten Blum , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition Date: Tue, 2 Jun 2026 18:07:57 +0200 Message-ID: <20260602160757.973736-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1128; i=thorsten.blum@linux.dev; h=from:subject; bh=jHEP54/xzr6y+gurc767XySok3MRWRWSy1e3YUVbHS4=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFly/+8mzX1jULiuR3pRpPntls7lrI92b1Dl/dj5yjp4R rSZVEpJRykLgxgXg6yYIsuDWT9m+JbWVG4yidgJM4eVCWQIAxenAEyk+iEjw4nsrc8k+8/bTvgd o75c4cAh6zQuvv1+a4M2GWt1NM9ZI8LIcGD5sSMd3D5GsWHh0wVrZkayZB069yH3Kt/2C9rLPfh d+AE= X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use min() to replace the open-coded implementations and to simplify riscix_partition() and linux_partition(). Signed-off-by: Thorsten Blum Reviewed-by: Kees Cook --- block/partitions/acorn.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/block/partitions/acorn.c b/block/partitions/acorn.c index 9f7389f174d0..067d6a27a3bd 100644 --- a/block/partitions/acorn.c +++ b/block/partitions/acorn.c @@ -9,6 +9,7 @@ */ #include #include +#include =20 #include "check.h" =20 @@ -80,7 +81,7 @@ static int riscix_partition(struct parsed_partitions *sta= te, =20 =20 if (rr->magic =3D=3D RISCIX_MAGIC) { - unsigned long size =3D nr_sects > 2 ? 2 : nr_sects; + unsigned long size =3D min(nr_sects, 2); int part; =20 seq_buf_puts(&state->pp_buf, " <"); @@ -124,7 +125,7 @@ static int linux_partition(struct parsed_partitions *st= ate, { Sector sect; struct linux_part *linuxp; - unsigned long size =3D nr_sects > 2 ? 2 : nr_sects; + unsigned long size =3D min(nr_sects, 2); =20 seq_buf_puts(&state->pp_buf, " [Linux]");