[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251117094652.b04c6cf841d6426f70f23d22@linux-foundation.org>
Date: Mon, 17 Nov 2025 09:46:52 -0800
From: Andrew Morton <akpm@...ux-foundation.org>
To: Guan-Chun Wu <409411716@....tku.edu.tw>
Cc: David Laight <david.laight.linux@...il.com>,
andriy.shevchenko@...el.com, axboe@...nel.dk, ceph-devel@...r.kernel.org,
ebiggers@...nel.org, hch@....de, home7438072@...il.com, idryomov@...il.com,
jaegeuk@...nel.org, kbusch@...nel.org, linux-fscrypt@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-nvme@...ts.infradead.org,
sagi@...mberg.me, tytso@....edu, visitorckw@...il.com, xiubli@...hat.com
Subject: Re: [PATCH v5 3/6] lib/base64: rework encode/decode for speed and
stricter validation
On Sun, 16 Nov 2025 18:28:49 +0800 Guan-Chun Wu <409411716@....tku.edu.tw> wrote:
> > Reviewed-by: David Laight <david.laight.linux@...il.com>
> >
> > But see minor nit below.
>
> Hi David,
>
> Thanks for the review and for pointing this out.
>
> Andrew, would it be possible for you to fold this small change
> (removing the redundant casts) directly when updating the patch?
> If that’s not convenient, I can resend an updated version of the
> series instead.
Sure, I added this:
--- a/lib/base64.c~lib-base64-rework-encode-decode-for-speed-and-stricter-validation-fix
+++ a/lib/base64.c
@@ -83,7 +83,7 @@ int base64_encode(const u8 *src, int src
const char *base64_table = base64_tables[variant];
while (srclen >= 3) {
- ac = (u32)src[0] << 16 | (u32)src[1] << 8 | (u32)src[2];
+ ac = src[0] << 16 | src[1] << 8 | src[2];
*cp++ = base64_table[ac >> 18];
*cp++ = base64_table[(ac >> 12) & 0x3f];
*cp++ = base64_table[(ac >> 6) & 0x3f];
@@ -95,7 +95,7 @@ int base64_encode(const u8 *src, int src
switch (srclen) {
case 2:
- ac = (u32)src[0] << 16 | (u32)src[1] << 8;
+ ac = src[0] << 16 | src[1] << 8;
*cp++ = base64_table[ac >> 18];
*cp++ = base64_table[(ac >> 12) & 0x3f];
*cp++ = base64_table[(ac >> 6) & 0x3f];
@@ -103,7 +103,7 @@ int base64_encode(const u8 *src, int src
*cp++ = '=';
break;
case 1:
- ac = (u32)src[0] << 16;
+ ac = src[0] << 16;
*cp++ = base64_table[ac >> 18];
*cp++ = base64_table[(ac >> 12) & 0x3f];
if (padding) {
_
Powered by blists - more mailing lists