powerpc/powernv/idle: Fix build error
authorAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Thu, 9 Aug 2018 13:37:20 +0000 (19:07 +0530)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 10 Aug 2018 12:12:39 +0000 (22:12 +1000)
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>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/platforms/powernv/idle.c

index ecb002c5db83b311a89055fa3b35c6cd3e94e08d..35f699ebb662189fd574ca23f43c089cf7b92a17 100644 (file)
@@ -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;