Linux block layer
 help / color / mirror / Atom feed
* [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition
@ 2026-06-02 16:07 Thorsten Blum
  2026-06-02 16:49 ` Kees Cook
  2026-06-02 17:19 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Thorsten Blum @ 2026-06-02 16:07 UTC (permalink / raw)
  To: Jens Axboe, Kees Cook, Josh Law; +Cc: Thorsten Blum, linux-block, linux-kernel

Use min() to replace the open-coded implementations and to simplify
riscix_partition() and linux_partition().

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 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 <linux/buffer_head.h>
 #include <linux/adfs_fs.h>
+#include <linux/minmax.h>
 
 #include "check.h"
 
@@ -80,7 +81,7 @@ static int riscix_partition(struct parsed_partitions *state,
 
 
 	if (rr->magic == RISCIX_MAGIC) {
-		unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+		unsigned long size = min(nr_sects, 2);
 		int part;
 
 		seq_buf_puts(&state->pp_buf, " <");
@@ -124,7 +125,7 @@ static int linux_partition(struct parsed_partitions *state,
 {
 	Sector sect;
 	struct linux_part *linuxp;
-	unsigned long size = nr_sects > 2 ? 2 : nr_sects;
+	unsigned long size = min(nr_sects, 2);
 
 	seq_buf_puts(&state->pp_buf, " [Linux]");
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition
  2026-06-02 16:07 [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition Thorsten Blum
@ 2026-06-02 16:49 ` Kees Cook
  2026-06-02 17:19 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2026-06-02 16:49 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Jens Axboe, Josh Law, linux-block, linux-kernel

On Tue, Jun 02, 2026 at 06:07:57PM +0200, Thorsten Blum wrote:
> Use min() to replace the open-coded implementations and to simplify
> riscix_partition() and linux_partition().
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

Seems good.

Reviewed-by: Kees Cook <kees@kernel.org>

-- 
Kees Cook

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition
  2026-06-02 16:07 [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition Thorsten Blum
  2026-06-02 16:49 ` Kees Cook
@ 2026-06-02 17:19 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2026-06-02 17:19 UTC (permalink / raw)
  To: Kees Cook, Josh Law, Thorsten Blum; +Cc: linux-block, linux-kernel


On Tue, 02 Jun 2026 18:07:57 +0200, Thorsten Blum wrote:
> Use min() to replace the open-coded implementations and to simplify
> riscix_partition() and linux_partition().

Applied, thanks!

[1/1] block/partitions/acorn: use min in {riscix,linux}_partition
      commit: aa528cd12ca6e7fda15f855b6d2095fd34d167e0

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-02 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-02 16:07 [PATCH] block/partitions/acorn: use min in {riscix,linux}_partition Thorsten Blum
2026-06-02 16:49 ` Kees Cook
2026-06-02 17:19 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox