From: York Sun <yorksun@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpy
Date: Mon, 29 Jun 2015 11:30:47 -0700 [thread overview]
Message-ID: <55918ED7.60902@freescale.com> (raw)
In-Reply-To: <SN1PR0301MB155002A63E47824917950B269BD00@SN1PR0301MB1550.namprd03.prod.outlook.com>
On 05/05/2015 06:40 PM, Zhao Qiang-B45475 wrote:
> On Tue, May 5, 2015 at 5:41 PM, Michael Trimarchi wrote:
>
>> -----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 strcpy
>>
>> Hi
>>
>> On Tue, May 5, 2015 at 5:15 PM, qiang.zhao at freescale.com
>> <qiang.zhao@freescale.com> wrote:
>>> On Tue, May 5, 2015 at 4:33 PM, Michael Trimarchi wrote:
>>>> -----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 strcpy
>>>>
>>>> Hi
>>>>
>>>> On Tue, May 5, 2015 at 3:53 PM, Zhao Qiang <B45475@freescale.com>
>> wrote:
>>>>> strncpy is safer than strcpy, use it to instead of strcpy.
>>>>>
>>>>> Signed-off-by: Zhao Qiang <B45475@freescale.com>
>>>>> ---
>>>>> drivers/qe/qe.c | 2 +-
>>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c index
>>>>> f1df0a4..08620b2
>>>>> 100644
>>>>> --- a/drivers/qe/qe.c
>>>>> +++ b/drivers/qe/qe.c
>>>>> @@ -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?
>>>
>>> The fireware->id is 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
next prev parent reply other threads:[~2015-06-29 18:30 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-05 7:53 [U-Boot] [PATCH 1/2] qe: transform parameter to compatible type Zhao Qiang
2015-05-05 7:53 ` [U-Boot] [PATCH 2/2] qe: use strncpy instead of strcpy Zhao Qiang
2015-05-05 8:32 ` Michael Trimarchi
2015-05-05 9:15 ` qiang.zhao at freescale.com
2015-05-05 9:40 ` Michael Trimarchi
2015-05-06 1:40 ` qiang.zhao at freescale.com
2015-05-06 5:21 ` Michael Trimarchi
2015-06-29 18:30 ` York Sun [this message]
2015-08-04 15:45 ` York Sun
2015-06-29 18:27 ` [U-Boot] [PATCH 1/2] qe: transform parameter to compatible type York Sun
2015-08-04 15:44 ` York Sun
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=55918ED7.60902@freescale.com \
--to=yorksun@freescale.com \
--cc=u-boot@lists.denx.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.