qe: transform parameter to compatible type
PATCH 1/2 qe: transform parameter to compatible type
when using printf, the parameter type need to be compatible type, so transform them to compatible type
--- drivers/qe/qe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/qe/qe.c +3 -2
@@ -313,9 +313,10 @@ static void qe_upload_microcode(const void *base,if (ucode->major || ucode->minor || ucode->revision)printf ("QE: uploading microcode '%s' version %u.%u.%u\n" , - ucode->id, ucode->major, ucode->minor, ucode->revision); + (char *)ucode->id, (u16 )ucode->major, (u16 )ucode->minor, + (u16 )ucode->revision);else -printf ("QE: uploading microcode '%s'\n" , ucode->id); +printf ("QE: uploading microcode '%s'\n" , (char *)ucode->id);/* Use auto-increment */ out_be32(&qe_immr->iram.iadd, be32_to_cpu(ucode->iram_offset) |
Signature · 1 line
2.1.0.27.g96db324
PATCH 2/2 qe: use strncpy instead of strcpy
strncpy is safer than strcpy, use it to instead of strcpy.
--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/qe/qe.c +1 -1
@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 ); qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps));
Signature · 1 line
2.1.0.27.g96db324
PATCH 2/2 qe: use strncpy instead of strcpy
Hi
Quoted 12 lines · Zhao Qiang
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c +0
-0
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware *firmware) · line 438
Quoted 5 lines
drivers/qe/qe.c +1
-1@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware *firmware)* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );
is 62 somenthing that can be calculated?
Quoted 10 lines
drivers/qe/qe.c +0
-1qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps)); --2.1.0.27.g96db324
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
PATCH 2/2 qe: use strncpy instead of strcpy
Quoted 23 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 4:33 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware
Quoted 12 lines · Zhao Qiang
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c index f1df0a4..08620b2 renamed from drivers/qe/qe.c +0
-0100644
drivers/qe/qe.c +0
-0@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware*firmware)
Quoted 7 lines
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware *firmware) · line 438
Quoted 5 lines
drivers/qe/qe.c +1
-1* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );is 62 somenthing that can be calculated?
The fireware->id is defined 62 bytes in the struct.
Quoted 11 lines
Quoted 11 lines
drivers/qe/qe.c +0
-1qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps)); --2.1.0.27.g96db324
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Best Regards
Zhao Qiang
PATCH 2/2 qe: use strncpy instead of strcpy
Hi
Quoted 30 lines · qiang.zhao at freescale.com
Quoted 29 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 4:33 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware
Quoted 12 lines · Zhao Qiang
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c index f1df0a4..08620b2 renamed from drivers/qe/qe.c +0
-0100644
drivers/qe/qe.c +0
-0@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware*firmware)
Quoted 5 lines
drivers/qe/qe.c +1
-1* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );
Quoted 4 lines
Quoted 1 line
is 62 somenthing that can be calculated?
The
fireware->idis defined 62 bytes in the struct.
and you don't like sizeof
Michael
Quoted 14 lines
Quoted 8 lines
Quoted 8 lines
drivers/qe/qe.c +0
-1qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps)); --2.1.0.27.g96db324
Quoted 4 lines
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-bootBest Regards
Zhao Qiang
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 2/2 qe: use strncpy instead of strcpy
Quoted 43 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 5:41 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
Quoted 11 lines · qiang.zhao at freescale.com
Quoted 10 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 4:33 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
On Tue, May 5, 2015 at 3:53 PM, Zhao Qiang <[email protected]>
Quoted 20 lines · wrote:
Quoted 20 lines
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware
Quoted 13 lines
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c index renamed from drivers/qe/qe.c +0
-0f1df0a4..08620b2
100644drivers/qe/qe.c +0
-0@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware*firmware)
Quoted 5 lines
drivers/qe/qe.c +1
-1* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
is 62 somenthing that can be calculated?
The
fireware->idis defined 62 bytes in the struct.and you don't like sizeof
Thank you for your suggestion.
If there are something else need to be modify,
I will use sizeof instead.
Quoted 27 lines
Michael
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/qe/qe.c +0
-1qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps)); --2.1.0.27.g96db324
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-bootBest Regards
Zhao Qiang--
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 2/2 qe: use strncpy instead of strcpy
Hi
Quoted 47 lines · qiang.zhao at freescale.com
Quoted 45 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 5:41 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
Quoted 11 lines · qiang.zhao at freescale.com
Quoted 10 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 4:33 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
On Tue, May 5, 2015 at 3:53 PM, Zhao Qiang <[email protected]>
Quoted 22 lines · wrote:
Quoted 21 lines
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware
Quoted 13 lines
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c index renamed from drivers/qe/qe.c +0
-0f1df0a4..08620b2
100644drivers/qe/qe.c +0
-0@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware*firmware)
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware *firmware) · line 438
Quoted 5 lines
drivers/qe/qe.c +1
-1* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );is 62 somenthing that can be calculated?
Quoted 9 lines
Quoted 4 lines
Quoted 2 lines
The
fireware->idis defined 62 bytes in the struct.and you don't like sizeof
Thank you for your suggestion.
If there are something else need to be modify,
I will use sizeof instead.
Sorry for boring you ;)
Michael
Quoted 27 lines
Quoted 27 lines
Michael
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
drivers/qe/qe.c +0
-1qe_firmware_info.extended_modes = firmware->extended_modes;memcpy (qe_firmware_info.vtraps, firmware->vtraps,sizeof (firmware->vtraps)); --2.1.0.27.g96db324
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-bootBest Regards
Zhao Qiang--
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 2/2 qe: use strncpy instead of strcpy
In reply to qiang.zhao at freescale.comQuoted 47 lines · On 05/05/2015 06:40 PM, Zhao Qiang-B45475 wrote:
Quoted 45 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 5:41 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
Quoted 11 lines · qiang.zhao at freescale.com
Quoted 10 lines · Michael Trimarchi
-----Original Message-----
From: Michael Trimarchi [mailto:michael at amarulasolutions.com]
Sent: Tuesday, May 05, 2015 4:33 PM
To: Zhao Qiang-B45475
Cc: u-boot at lists.denx.de; Sun York-R58495
Subject: Re: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpyHi
On Tue, May 5, 2015 at 3:53 PM, Zhao Qiang <[email protected]>
Quoted 22 lines · wrote:
Quoted 21 lines
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware
Quoted 13 lines
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/qe/qe.c index renamed from drivers/qe/qe.c +0
-0f1df0a4..08620b2
100644drivers/qe/qe.c +0
-0@@ -435,7 +435,7 @@ int qe_upload_firmware(const struct qe_firmware*firmware)
drivers/qe/qe.c int qe_upload_firmware(const struct qe_firmware *firmware) · line 438
Quoted 5 lines
drivers/qe/qe.c +1
-1* saved microcode information and put in the new. */ memset (&qe_firmware_info,0 ,sizeof (qe_firmware_info)); -strcpy (qe_firmware_info.id, (char *)firmware->id); +strncpy (qe_firmware_info.id, (char *)firmware->id,62 );is 62 somenthing that can be calculated?
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
The
fireware->idis defined 62 bytes in the struct.and you don't like sizeof
Thank you for your suggestion.
If there are something else need to be modify,
I will use sizeof instead.
Looks like the id is a null-terminated string. Do you face the same issue as patch 1/2 in this set? Would it be better to change the type to char?
York
PATCH 2/2 qe: use strncpy instead of strcpy
In reply to Zhao QiangQuoted 4 lines · Zhao Qiang
strncpy is safer than strcpy, use it to instead of strcpy.
Signed-off-by Zhao Qiang <[email protected]>---
Applied to u-boot-fsl-qoriq master. Thanks.
York
PATCH 1/2 qe: transform parameter to compatible type
In reply to Zhao QiangQuoted 13 lines · Zhao Qiang
when using printf, the parameter type need to be compatible type, so transform them to compatible type
Signed-off-by Zhao Qiang <[email protected]>--- drivers/qe/qe.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/qe/qe.c +0
-0
drivers/qe/qe.c static void qe_upload_microcode(const void *base, · line 320
Quoted 10 lines
drivers/qe/qe.c +3
-2@@ -313,9 +313,10 @@ static void qe_upload_microcode(const void *base,if (ucode->major || ucode->minor || ucode->revision)printf ("QE: uploading microcode '%s' version %u.%u.%u\n" , - ucode->id, ucode->major, ucode->minor, ucode->revision); + (char *)ucode->id, (u16 )ucode->major, (u16 )ucode->minor, + (u16 )ucode->revision);else -printf ("QE: uploading microcode '%s'\n" , ucode->id); +printf ("QE: uploading microcode '%s'\n" , (char *)ucode->id);
Would it be more appropriate to fix the structure in qe.h?
Is the size fixed for major and minor? They are declared as u8. I can't find doc/README.qe_firmware as mentioned in the comment.
York
PATCH 1/2 qe: transform parameter to compatible type
In reply to Zhao QiangQuoted 5 lines · Zhao Qiang
when using printf, the parameter type need to be compatible type, so transform them to compatible type
Signed-off-by Zhao Qiang <[email protected]>---
Applied to u-boot-fsl-qoriq master. Thanks.
York