[Sound-open-firmware] [PATCH v2 3/3] rimge: initial the char array.

Pan, Xiuli xiuli.pan at intel.com
Fri Jan 26 10:24:03 CET 2018


There is a typo in the patch name. rimge == > rimage.

>-----Original Message-----
>From: sound-open-firmware-bounces at alsa-project.org [mailto:sound-open-
>firmware-bounces at alsa-project.org] On Behalf Of xionghu.luo at linux.intel.com
>Sent: Friday, January 26, 2018 16:36
>To: sound-open-firmware at alsa-project.org
>Cc: Luo, Xionghu <xionghu.luo at intel.com>; xionghu.luo at linux.intel.com
>Subject: [Sound-open-firmware] [PATCH v2 3/3] rimge: initial the char array.
>
>From: Luo Xionghu <xionghu.luo at intel.com>
>
>the variable maybe used uninitalied, initialize it to empty.
>If the image->key_name is NULL, restore it to NULL before return.
>
>---
>v2: if path is modified in the function, strcmp returns not 0.
>
>Signed-off-by: Luo Xionghu <xionghu.luo at intel.com>
>---
> rimage/pkcs1_5.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
>diff --git a/rimage/pkcs1_5.c b/rimage/pkcs1_5.c
>index 0c5806b..feffb7b 100644
>--- a/rimage/pkcs1_5.c
>+++ b/rimage/pkcs1_5.c
>@@ -56,7 +56,9 @@ int pkcs_sign(struct image *image, struct
>fw_image_manifest *man,
> 	RSA *priv_rsa = NULL;
> 	EVP_PKEY *privkey;
> 	FILE *fp;
>-	unsigned char digest[SHA256_DIGEST_LENGTH], path[256],
>mod[MAN_RSA_KEY_MODULUS_LEN];
>+	unsigned char path[256] = "";
>+	unsigned char digest[SHA256_DIGEST_LENGTH];
>+	unsigned char mod[MAN_RSA_KEY_MODULUS_LEN];
> 	unsigned int siglen = MAN_RSA_SIGNATURE_LEN;
> 	int ret = -EINVAL, i;
>
>@@ -80,6 +82,8 @@ int pkcs_sign(struct image *image, struct
>fw_image_manifest *man,
> 	fp = fopen(image->key_name, "r");
> 	if (fp == NULL) {
> 		fprintf(stderr, "error: can't open file %s %d\n", path, -errno);
>+		if (strcmp(path, ""))
>+			image->key_name = NULL;
> 		return -errno;
> 	}
> 	PEM_read_PrivateKey(fp, &privkey, NULL, NULL);
>--
>2.11.0
>
>_______________________________________________
>Sound-open-firmware mailing list
>Sound-open-firmware at alsa-project.org
>http://mailman.alsa-project.org/mailman/listinfo/sound-open-firmware


More information about the Sound-open-firmware mailing list