Patch "drm/msm: use strscpy instead of strncpy" has been added to the 5.4-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    drm/msm: use strscpy instead of strncpy

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-msm-use-strscpy-instead-of-strncpy.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit cc1eadd3fe39f1fcdfa91dece0281a331e4ce28e
Author: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
Date:   Wed Jan 18 04:01:52 2023 +0200

    drm/msm: use strscpy instead of strncpy
    
    [ Upstream commit d7fd8634f48d76aa799ed57beb7d87dab91bde80 ]
    
    Using strncpy can result in non-NULL-terminated destination string. Use
    strscpy instead. This fixes following warning:
    
    drivers/gpu/drm/msm/msm_fence.c: In function ‘msm_fence_context_alloc’:
    drivers/gpu/drm/msm/msm_fence.c:25:9: warning: ‘strncpy’ specified bound 32 equals destination size [-Wstringop-truncation]
       25 |         strncpy(fctx->name, name, sizeof(fctx->name));
          |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    Fixes: f97decac5f4c ("drm/msm: Support multiple ringbuffers")
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Reviewed-by: Abhinav Kumar <quic_abhinavk@xxxxxxxxxxx>
    Patchwork: https://patchwork.freedesktop.org/patch/518787/
    Link: https://lore.kernel.org/r/20230118020152.1689213-1-dmitry.baryshkov@xxxxxxxxxx
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c
index cd59a59180385..50a25c119f4d9 100644
--- a/drivers/gpu/drm/msm/msm_fence.c
+++ b/drivers/gpu/drm/msm/msm_fence.c
@@ -20,7 +20,7 @@ msm_fence_context_alloc(struct drm_device *dev, const char *name)
 		return ERR_PTR(-ENOMEM);
 
 	fctx->dev = dev;
-	strncpy(fctx->name, name, sizeof(fctx->name));
+	strscpy(fctx->name, name, sizeof(fctx->name));
 	fctx->context = dma_fence_context_alloc(1);
 	init_waitqueue_head(&fctx->event);
 	spin_lock_init(&fctx->spinlock);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux