drm/exynos: fix accidental on-stack copy of exynos_drm_plane
Subsystems (3)
PATCH 1/1 drm/exynos: fix accidental on-stack copy of exynos_drm_plane
From: Arnd Bergmann <[email protected]>
gcc rightfully complains about excessive stack usage in the fimd_win_set_pixfmt() function:
drivers/gpu/drm/exynos/exynos_drm_fimd.c: In function 'fimd_win_set_pixfmt':drivers/gpu/drm/exynos/exynos_drm_fimd.c:750:1: error: the frame size of 1032 bytes is larger than 1024 byte drivers/gpu/drm/exynos/exynos5433_drm_decon.c: In function 'decon_win_set_pixfmt':drivers/gpu/drm/exynos/exynos5433_drm_decon.c:381:1: error: the frame size of 1032 bytes is larger than 1024 bytes
There is really no reason to copy the large exynos_drm_plane structure to the stack before using one of its members, so just use a pointer instead.
--- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/exynos/exynos5433_drm_decon.c +2 -2
@@ -319,9 +319,9 @@ static void decon_win_set_bldmod(struct decon_context *ctx, unsigned int win,static void decon_win_set_pixfmt (struct decon_context *ctx,unsigned int win,struct drm_framebuffer *fb) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);unsigned int alpha = state->base.alpha;unsigned int pixel_alpha;unsigned long val;
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2 -2
@@ -661,9 +661,9 @@ static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win,static void fimd_win_set_pixfmt (struct fimd_context *ctx,unsigned int win,struct drm_framebuffer *fb,int width) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);uint32_t pixel_format = fb->format->format;unsigned int alpha = state->base.alpha;u32 val = WINCONx_ENWIN;
Signature · 1 line
2.39.2
Quoted 10 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
gcc rightfully complains about excessive stack usage in the
fimd_win_set_pixfmt()function:
drivers/gpu/drm/exynos/exynos_drm_fimd.c: In function 'fimd_win_set_pixfmt':drivers/gpu/drm/exynos/exynos_drm_fimd.c:750:1: error: the frame size of 1032 bytes is larger than 1024 bytedrivers/gpu/drm/exynos/exynos5433_drm_decon.c: In function 'decon_win_set_pixfmt':drivers/gpu/drm/exynos/exynos5433_drm_decon.c:381:1: error: the frame size of 1032 bytes is larger than 1024 bytes
Quoted 6 lines
There is really no reason to copy the large
exynos_drm_planestructure to the stack before using one of its members, so just use a pointer instead.Fixes 6f8ee5c21722 ("drm/exynos: fimd: Make plane alpha configurable")Signed-off-by Arnd Bergmann <[email protected]>
Quoted 27 lines
--- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/gpu/drm/exynos/exynos5433_drm_decon.c +2
-2@@ -319,9 +319,9 @@ static void decon_win_set_bldmod(struct decon_context *ctx, unsigned int win,static void decon_win_set_pixfmt (struct decon_context *ctx,unsigned int win,struct drm_framebuffer *fb) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);unsigned int alpha = state->base.alpha;unsigned int pixel_alpha;unsigned long val;drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -661,9 +661,9 @@ static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win,
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, · line 669
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2struct drm_framebuffer *fb, int width) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);uint32_t pixel_format = fb->format->format;unsigned int alpha = state->base.alpha;u32 val = WINCONx_ENWIN;
Best regards
Signature · 2 lines
Marek Szyprowski, PhD Samsung R&D Institute Poland
2023년 12월 15일 (금) 오전 12:59, Marek Szyprowski <[email protected]>님이 작성:
Quoted 20 lines · Arnd Bergmann
Quoted 3 lines
From: Arnd Bergmann <[email protected]>
gcc rightfully complains about excessive stack usage in the
fimd_win_set_pixfmt()Quoted 3 lines
function:
drivers/gpu/drm/exynos/exynos_drm_fimd.c: In function'
fimd_win_set_pixfmt':Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_fimd.c:750:1: error: the frame size of1032 bytes is larger than 1024 byte
Quoted 1 line
drivers/gpu/drm/exynos/exynos5433_drm_decon.c: In function'
decon_win_set_pixfmt':Quoted 1 line
drivers/gpu/drm/exynos/exynos5433_drm_decon.c:381:1: error: the framesize of 1032 bytes is larger than 1024 bytes
Quoted 5 lines
There is really no reason to copy the large
exynos_drm_planestructure to the stack before using one of its members, so just use a pointer instead.
Quoted 6 lines
Quoted 2 lines
Fixes 6f8ee5c21722 ("drm/exynos: fimd: Make plane alpha configurable")Signed-off-by Arnd Bergmann <[email protected]>Reviewed-by Marek Szyprowski <[email protected]>
Thanks,
Inki Dae
Quoted 52 lines
Review
Quoted 8 lines
--- drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 4 ++-- drivers/gpu/drm/exynos/exynos_drm_fimd.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos5433_drm_decon.cdrivers/gpu/drm/exynos/exynos5433_drm_decon.c static void decon_win_set_bldmod(struct
Quoted 4 lines
index
4d986077738b..bce027552474100644drivers/gpu/drm/exynos/exynos5433_drm_decon.c +0
-0@@ -319,9 +319,9 @@ static void decon_win_set_bldmod(struct
decon_context*ctx, unsigned int win,drivers/gpu/drm/exynos/exynos5433_drm_decon.c static void decon_win_set_bldmod(struct · line 319
Quoted 1 line
drivers/gpu/drm/exynos/exynos5433_drm_decon.c +0
-0static void decon_win_set_pixfmt(struct decon_context *ctx, unsignedint win,
Review
Quoted 11 lines
drivers/gpu/drm/exynos/exynos5433_drm_decon.c +2
-2struct drm_framebuffer *fb) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);unsigned int alpha = state->base.alpha;unsigned int pixel_alpha;unsigned long val;(quoted diff) +0
-0
b/drivers/gpu/drm/exynos/exynos_drm_fimd.cdrivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_set_bldmod(struct fimd_context
Quoted 4 lines
index
8dde7b1e9b35..5bdc246f5fad100644drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0@@ -661,9 +661,9 @@ static void fimd_win_set_bldmod(struct fimd_context*ctx, unsigned int win,
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_set_bldmod(struct fimd_context · line 661
Quoted 1 line
drivers/gpu/drm/exynos/exynos_drm_fimd.c +0
-0static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned intwin,
drivers/gpu/drm/exynos/exynos_drm_fimd.c static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, · line 669
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_drm_fimd.c +2
-2struct drm_framebuffer *fb, int width) { -struct exynos_drm_plane plane = ctx->planes[win]; +struct exynos_drm_plane *plane = &ctx->planes[win];struct exynos_drm_plane_state *state = -to_exynos_plane_state (plane.base.state); +to_exynos_plane_state (plane->base.state);uint32_t pixel_format = fb->format->format;unsigned int alpha = state->base.alpha;u32 val = WINCONx_ENWIN;Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland