Re: [RFC PATCH v1 2/2] scsi: ufs: core: Add OP-TEE based RPMB driver for UFS devices

From: Bean Huo
Date: Tue Sep 16 2025 - 09:28:19 EST



Bart,

On Mon, 2025-09-15 at 15:06 -0700, Bart Van Assche wrote:
> > +       /*
> > +        * Use serial number as device ID. Copy ASCII serial number data.
> > +        * This provides a unique device identifier for RPMB operations.
> > +        */
> > +       strncpy((char *)cid, sn, sizeof(cid) - 1);
>
> strncpy() into an u32 array? Really? There are multiple alternatives
> available in the kernel that are better than strncpy(). Are you sure
> that you want to use strncpy()? Additionally, does copying a string into
> a u32 array introduce any endianness issues?
>

I will change to:

u8 cid[16] = { };

/* Copy ASCII serial number into device ID (max 15 chars + NUL). */
strscpy(cid, sn, sizeof(cid));


> > +MODULE_DESCRIPTION("UFS RPMB integration into the RPBM framework using SCSI Secure In/Out");
>
> RPBM or RPMB?
>
> >         } else {
> > -               str = kmemdup(uc_str, uc_str->len, GFP_KERNEL);
> > +               str = kmemdup(uc_str->uc, uc_str->len, GFP_KERNEL);
>
> Is the above change perhaps a bug fix that is completely independent of
> the rest of this patch?

sure, will be added in next version. thanks for Reviewing!

Kind regards,
Bean