* [PATCH] powerpc/powernv/idle: Fix build error
@ 2018-08-09 13:37 Aneesh Kumar K.V
2018-08-10 7:10 ` Michael Ellerman
2018-08-13 11:23 ` Michael Ellerman
0 siblings, 2 replies; 5+ messages in thread
From: Aneesh Kumar K.V @ 2018-08-09 13:37 UTC (permalink / raw)
To: npiggin, benh, paulus, mpe; +Cc: linuxppc-dev, Aneesh Kumar K.V
Fix the below build error using strlcpy instead of strncpy
In function 'pnv_parse_cpuidle_dt',
inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
strncpy(pnv_idle_states[i].name, temp_string[i],
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PNV_IDLE_NAME_LEN);
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
---
arch/powerpc/platforms/powernv/idle.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
index ecb002c5db83..35f699ebb662 100644
--- a/arch/powerpc/platforms/powernv/idle.c
+++ b/arch/powerpc/platforms/powernv/idle.c
@@ -817,7 +817,7 @@ static int pnv_parse_cpuidle_dt(void)
goto out;
}
for (i = 0; i < nr_idle_states; i++)
- strncpy(pnv_idle_states[i].name, temp_string[i],
+ strlcpy(pnv_idle_states[i].name, temp_string[i],
PNV_IDLE_NAME_LEN);
nr_pnv_idle_states = nr_idle_states;
rc = 0;
--
2.17.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/powernv/idle: Fix build error
2018-08-09 13:37 [PATCH] powerpc/powernv/idle: Fix build error Aneesh Kumar K.V
@ 2018-08-10 7:10 ` Michael Ellerman
2018-08-13 6:26 ` Alexey Kardashevskiy
2018-08-13 11:23 ` Michael Ellerman
1 sibling, 1 reply; 5+ messages in thread
From: Michael Ellerman @ 2018-08-10 7:10 UTC (permalink / raw)
To: Aneesh Kumar K.V, npiggin, benh, paulus; +Cc: linuxppc-dev, Aneesh Kumar K.V
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
> Fix the below build error using strlcpy instead of strncpy
>
> In function 'pnv_parse_cpuidle_dt',
> inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
> inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
> arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
> strncpy(pnv_idle_states[i].name, temp_string[i],
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> PNV_IDLE_NAME_LEN);
I'm curious why I haven't seen this? What compiler are you using?
cheers
> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
> index ecb002c5db83..35f699ebb662 100644
> --- a/arch/powerpc/platforms/powernv/idle.c
> +++ b/arch/powerpc/platforms/powernv/idle.c
> @@ -817,7 +817,7 @@ static int pnv_parse_cpuidle_dt(void)
> goto out;
> }
> for (i = 0; i < nr_idle_states; i++)
> - strncpy(pnv_idle_states[i].name, temp_string[i],
> + strlcpy(pnv_idle_states[i].name, temp_string[i],
> PNV_IDLE_NAME_LEN);
> nr_pnv_idle_states = nr_idle_states;
> rc = 0;
> --
> 2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/powernv/idle: Fix build error
2018-08-10 7:10 ` Michael Ellerman
@ 2018-08-13 6:26 ` Alexey Kardashevskiy
2018-08-14 4:09 ` Michael Ellerman
0 siblings, 1 reply; 5+ messages in thread
From: Alexey Kardashevskiy @ 2018-08-13 6:26 UTC (permalink / raw)
To: Michael Ellerman, Aneesh Kumar K.V, npiggin, benh, paulus; +Cc: linuxppc-dev
On 10/08/2018 17:10, Michael Ellerman wrote:
> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>
>> Fix the below build error using strlcpy instead of strncpy
>>
>> In function 'pnv_parse_cpuidle_dt',
>> inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
>> inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
>> arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
>> strncpy(pnv_idle_states[i].name, temp_string[i],
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> PNV_IDLE_NAME_LEN);
>
> I'm curious why I haven't seen this? What compiler are you using?
gcc 8 does this.
>
> cheers
>
>> diff --git a/arch/powerpc/platforms/powernv/idle.c b/arch/powerpc/platforms/powernv/idle.c
>> index ecb002c5db83..35f699ebb662 100644
>> --- a/arch/powerpc/platforms/powernv/idle.c
>> +++ b/arch/powerpc/platforms/powernv/idle.c
>> @@ -817,7 +817,7 @@ static int pnv_parse_cpuidle_dt(void)
>> goto out;
>> }
>> for (i = 0; i < nr_idle_states; i++)
>> - strncpy(pnv_idle_states[i].name, temp_string[i],
>> + strlcpy(pnv_idle_states[i].name, temp_string[i],
>> PNV_IDLE_NAME_LEN);
>> nr_pnv_idle_states = nr_idle_states;
>> rc = 0;
>> --
>> 2.17.1
--
Alexey
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: powerpc/powernv/idle: Fix build error
2018-08-09 13:37 [PATCH] powerpc/powernv/idle: Fix build error Aneesh Kumar K.V
2018-08-10 7:10 ` Michael Ellerman
@ 2018-08-13 11:23 ` Michael Ellerman
1 sibling, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2018-08-13 11:23 UTC (permalink / raw)
To: Aneesh Kumar K.V, npiggin, benh, paulus; +Cc: Aneesh Kumar K.V, linuxppc-dev
On Thu, 2018-08-09 at 13:37:20 UTC, "Aneesh Kumar K.V" wrote:
> Fix the below build error using strlcpy instead of strncpy
>
> In function 'pnv_parse_cpuidle_dt',
> inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
> inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
> arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
> strncpy(pnv_idle_states[i].name, temp_string[i],
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> PNV_IDLE_NAME_LEN);
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/ae24ce5e12127eeef6bf946c3ee0e9
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] powerpc/powernv/idle: Fix build error
2018-08-13 6:26 ` Alexey Kardashevskiy
@ 2018-08-14 4:09 ` Michael Ellerman
0 siblings, 0 replies; 5+ messages in thread
From: Michael Ellerman @ 2018-08-14 4:09 UTC (permalink / raw)
To: Alexey Kardashevskiy, Aneesh Kumar K.V, npiggin, benh, paulus
Cc: linuxppc-dev
Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> On 10/08/2018 17:10, Michael Ellerman wrote:
>> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>>
>>> Fix the below build error using strlcpy instead of strncpy
>>>
>>> In function 'pnv_parse_cpuidle_dt',
>>> inlined from 'pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:840:7,
>>> inlined from '__machine_initcall_powernv_pnv_init_idle_states' at arch/powerpc/platforms/powernv/idle.c:870:1:
>>> arch/powerpc/platforms/powernv/idle.c:820:3: error: 'strncpy' specified bound 16 equals destination size [-Werror=stringop-truncation]
>>> strncpy(pnv_idle_states[i].name, temp_string[i],
>>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>> PNV_IDLE_NAME_LEN);
>>
>> I'm curious why I haven't seen this? What compiler are you using?
>
> gcc 8 does this.
Yeah you're right. It was hidden by another build failure in my build
scripts :/
cheers
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-14 4:09 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-09 13:37 [PATCH] powerpc/powernv/idle: Fix build error Aneesh Kumar K.V
2018-08-10 7:10 ` Michael Ellerman
2018-08-13 6:26 ` Alexey Kardashevskiy
2018-08-14 4:09 ` Michael Ellerman
2018-08-13 11:23 ` Michael Ellerman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).