* [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program
@ 2020-10-02 4:05 Pujin Shi
2020-10-02 4:05 ` [PATCH 2/2] scsi: ufs: Use memset to initialize variable in ufshcd_clear_keyslot Pujin Shi
2020-10-02 4:19 ` [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Eric Biggers
0 siblings, 2 replies; 3+ messages in thread
From: Pujin Shi @ 2020-10-02 4:05 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen
Cc: Alim Akhtar, Avri Altman, Eric Biggers, Satya Tangirala,
Stanley Chu, linux-scsi, linux-kernel, hankinsea, shipujin.t
Clang warns:
drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
union ufs_crypto_cfg_entry cfg = { 0 };
^
Signed-off-by: Pujin Shi <shipujin.t@gmail.com>
---
drivers/scsi/ufs/ufshcd-crypto.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
index d2edbd960ebf..8fca2a40c517 100644
--- a/drivers/scsi/ufs/ufshcd-crypto.c
+++ b/drivers/scsi/ufs/ufshcd-crypto.c
@@ -59,9 +59,11 @@ static int ufshcd_crypto_keyslot_program(struct blk_keyslot_manager *ksm,
u8 data_unit_mask = key->crypto_cfg.data_unit_size / 512;
int i;
int cap_idx = -1;
- union ufs_crypto_cfg_entry cfg = { 0 };
+ union ufs_crypto_cfg_entry cfg;
int err;
+ memset(&cfg, 0, sizeof(cfg));
+
BUILD_BUG_ON(UFS_CRYPTO_KEY_SIZE_INVALID != 0);
for (i = 0; i < hba->crypto_capabilities.num_crypto_cap; i++) {
if (ccap_array[i].algorithm_id == alg->ufs_alg &&
--
2.18.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 2/2] scsi: ufs: Use memset to initialize variable in ufshcd_clear_keyslot
2020-10-02 4:05 [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Pujin Shi
@ 2020-10-02 4:05 ` Pujin Shi
2020-10-02 4:19 ` [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Eric Biggers
1 sibling, 0 replies; 3+ messages in thread
From: Pujin Shi @ 2020-10-02 4:05 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen
Cc: Alim Akhtar, Avri Altman, Eric Biggers, Satya Tangirala,
Stanley Chu, linux-scsi, linux-kernel, hankinsea, shipujin.t
Clang warns:
drivers/scsi/ufs/ufshcd-crypto.c:103:8: warning: missing braces around initializer [-Wmissing-braces]
union ufs_crypto_cfg_entry cfg = { 0 };
^
Signed-off-by: Pujin Shi <shipujin.t@gmail.com>
---
drivers/scsi/ufs/ufshcd-crypto.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
index 8fca2a40c517..bd439021ccce 100644
--- a/drivers/scsi/ufs/ufshcd-crypto.c
+++ b/drivers/scsi/ufs/ufshcd-crypto.c
@@ -103,6 +103,9 @@ static int ufshcd_clear_keyslot(struct ufs_hba *hba, int slot)
* might not be sufficient, so just clear the entire cfg.
*/
union ufs_crypto_cfg_entry cfg = { 0 };
+ union ufs_crypto_cfg_entry cfg;
+
+ memset(&cfg, 0, sizeof(cfg));
return ufshcd_program_key(hba, &cfg, slot);
}
--
2.18.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program
2020-10-02 4:05 [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Pujin Shi
2020-10-02 4:05 ` [PATCH 2/2] scsi: ufs: Use memset to initialize variable in ufshcd_clear_keyslot Pujin Shi
@ 2020-10-02 4:19 ` Eric Biggers
1 sibling, 0 replies; 3+ messages in thread
From: Eric Biggers @ 2020-10-02 4:19 UTC (permalink / raw)
To: Pujin Shi
Cc: James E . J . Bottomley, Martin K . Petersen, Alim Akhtar,
Avri Altman, Satya Tangirala, Stanley Chu, linux-scsi,
linux-kernel, hankinsea
On Fri, Oct 02, 2020 at 12:05:17PM +0800, Pujin Shi wrote:
> Clang warns:
>
> drivers/scsi/ufs/ufshcd-crypto.c:62:8: warning: missing braces around initializer [-Wmissing-braces]
> union ufs_crypto_cfg_entry cfg = { 0 };
> ^
>
Which version of clang? I don't see the warning with clang 10.0.1
(or with gcc 10.2.0).
> Signed-off-by: Pujin Shi <shipujin.t@gmail.com>
> ---
> drivers/scsi/ufs/ufshcd-crypto.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
> index d2edbd960ebf..8fca2a40c517 100644
> --- a/drivers/scsi/ufs/ufshcd-crypto.c
> +++ b/drivers/scsi/ufs/ufshcd-crypto.c
> @@ -59,9 +59,11 @@ static int ufshcd_crypto_keyslot_program(struct blk_keyslot_manager *ksm,
> u8 data_unit_mask = key->crypto_cfg.data_unit_size / 512;
> int i;
> int cap_idx = -1;
> - union ufs_crypto_cfg_entry cfg = { 0 };
> + union ufs_crypto_cfg_entry cfg;
> int err;
>
> + memset(&cfg, 0, sizeof(cfg));
> +
How about an empty initializer?
union ufs_crypto_cfg_entry cfg = {};
Same comments on your other patch.
- Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-02 4:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-02 4:05 [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Pujin Shi
2020-10-02 4:05 ` [PATCH 2/2] scsi: ufs: Use memset to initialize variable in ufshcd_clear_keyslot Pujin Shi
2020-10-02 4:19 ` [PATCH 1/2] scsi: ufs: Use memset to initialize variable in ufshcd_crypto_keyslot_program Eric Biggers
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®