Re: [PATCH 3/6] drm/amdgpu: prefer snprintf over sprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 12 Jan 2024, Alex Deucher <alexdeucher@xxxxxxxxx> wrote:
> On Wed, Jan 10, 2024 at 12:39 PM Jani Nikula <jani.nikula@xxxxxxxxx> wrote:
>>
>> This will trade the W=1 warning -Wformat-overflow to
>> -Wformat-truncation. This lets us enable -Wformat-overflow subsystem
>> wide.
>>
>> Cc: Alex Deucher <alexander.deucher@xxxxxxx>
>> Cc: Christian König <christian.koenig@xxxxxxx>
>> Cc: Pan, Xinhui <Xinhui.Pan@xxxxxxx>
>> Cc: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
>> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
>
> Acked-by: Alex Deucher <alexander.deucher@xxxxxxx>
>
> Feel free to take this via whichever tree makes sense.

Thanks, pushed this one patch to drm-misc-next as prep work.

BR,
Jani.

>
> Alex
>
>> ---
>>  drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> index b9674c57c436..82b4b2019fca 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gfx.c
>> @@ -329,7 +329,8 @@ int amdgpu_gfx_kiq_init_ring(struct amdgpu_device *adev,
>>
>>         ring->eop_gpu_addr = kiq->eop_gpu_addr;
>>         ring->no_scheduler = true;
>> -       sprintf(ring->name, "kiq_%d.%d.%d.%d", xcc_id, ring->me, ring->pipe, ring->queue);
>> +       snprintf(ring->name, sizeof(ring->name), "kiq_%d.%d.%d.%d",
>> +                xcc_id, ring->me, ring->pipe, ring->queue);
>>         r = amdgpu_ring_init(adev, ring, 1024, irq, AMDGPU_CP_KIQ_IRQ_DRIVER0,
>>                              AMDGPU_RING_PRIO_DEFAULT, NULL);
>>         if (r)
>> --
>> 2.39.2
>>

-- 
Jani Nikula, Intel




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux