mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Bean Huo <beanhuo@iokpp.de>
To: Jorge Ramirez-Ortiz <jorge.ramirez@oss.qualcomm.com>,
	 alim.akhtar@samsung.com, avri.altman@wdc.com,
	bvanassche@acm.org,  James.Bottomley@HansenPartnership.com,
	martin.petersen@oracle.com,  beanhuo@micron.com,
	can.guo@oss.qualcomm.com
Cc: linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org,
	 op-tee@lists.trustedfirmware.org, jenswi@kernel.org,
	sumit.garg@oss.qualcomm.com
Subject: Re: [PATCH 2/2] ufs: rpmb: use a fixed-length RPMB dev_id
Date: Wed, 05 Aug 2026 18:49:54 +0200	[thread overview]
Message-ID: <e83a4cdc8f2361d7be16358ef501b4d017078ac0.camel@iokpp.de> (raw)
In-Reply-To: <20260715214327.1933560-3-jorge.ramirez@oss.qualcomm.com>

On Wed, 2026-07-15 at 23:39 +0200, Jorge Ramirez-Ortiz wrote:
> @@ -156,6 +158,7 @@ int ufs_rpmb_probe(struct ufs_hba *hba)
>  {
>         struct ufs_rpmb_dev *ufs_rpmb, *it, *tmp;
>         struct rpmb_dev *rdev;
> +       char *dev_id = NULL;
>         char *cid = NULL;
>         int region;
>         u32 cap;
> @@ -215,8 +218,17 @@ int ufs_rpmb_probe(struct ufs_hba *hba)
>                         goto err_out;
>                 }
>  
> -               descr.dev_id = cid;
> -               descr.dev_id_len = strlen(cid);
> +               dev_id = kzalloc(UFS_RPMB_ID_LEN, GFP_KERNEL);
> +               if (!dev_id) {
> +                       device_unregister(&ufs_rpmb->dev);
> +                       ret = -ENOMEM;
> +                       goto err_out;
> +               }


since rpmb_dev_register() kmemdups dev_id, can we use this: 


        u8 dev_id[UFS_RPMB_ID_LEN];
        blake2b(NULL, 0, cid, strlen(cid), dev_id, UFS_RPMB_ID_LEN);
        descr.dev_id = dev_id;
        descr.dev_id_len = UFS_RPMB_ID_LEN;

 
then you could drop allocation and its error branch and both kfree()?


Kind regards, 
Bean



      reply	other threads:[~2026-08-05 16:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 21:39 ufs: rpmb: make RPMB usable with OP-TEE key derivation Jorge Ramirez-Ortiz
2026-07-15 21:39 ` [PATCH 1/2] ufs: rpmb: retry power-on UNIT ATTENTION on the RPMB WLUN Jorge Ramirez-Ortiz
2026-07-17 21:10   ` Bart Van Assche
2026-07-15 21:39 ` [PATCH 2/2] ufs: rpmb: use a fixed-length RPMB dev_id Jorge Ramirez-Ortiz
2026-08-05 16:49   ` Bean Huo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e83a4cdc8f2361d7be16358ef501b4d017078ac0.camel@iokpp.de \
    --to=beanhuo@iokpp.de \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=can.guo@oss.qualcomm.com \
    --cc=jenswi@kernel.org \
    --cc=jorge.ramirez@oss.qualcomm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=op-tee@lists.trustedfirmware.org \
    --cc=sumit.garg@oss.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®