From: Sven Schnelle Date: Wed, 8 Jan 2025 14:27:05 +0000 (+0100) Subject: s390/ebcdic: Fix length check in codepage_convert() X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=4a0f62a3009be6515f5863970994a350a938ac52;p=users%2Fjedix%2Flinux-maple.git s390/ebcdic: Fix length check in codepage_convert() The current code compares whether the nr argument is less or equal to zero. As nr is of type unsigned long, this isn't correct. Fix this by just testing for zero. This is also reported by checkpatch: unsignedLessThanZero: Checking if unsigned expression 'nr--' is less than zero. Reported-by: Jens Remus Signed-off-by: Sven Schnelle Reviewed-by: Heiko Carstens Signed-off-by: Alexander Gordeev --- diff --git a/arch/s390/include/asm/ebcdic.h b/arch/s390/include/asm/ebcdic.h index cfa3405523282..7fdb6b92985a9 100644 --- a/arch/s390/include/asm/ebcdic.h +++ b/arch/s390/include/asm/ebcdic.h @@ -22,7 +22,7 @@ extern __u8 _ebc_toupper[256]; /* EBCDIC -> uppercase */ static inline void codepage_convert(const __u8 *codepage, volatile char *addr, unsigned long nr) { - if (nr-- <= 0) + if (!nr--) return; asm volatile( " j 2f\n"