Skip to content

Commit 25feda6

Browse files
keeskarolherbst
authored andcommitted
drm/nouveau/disp: More DP_RECEIVER_CAP_SIZE array fixes
More arrays (and arguments) for dcpd were set to 16, when it looks like DP_RECEIVER_CAP_SIZE (15) should be used. Fix the remaining cases, seen with GCC 13: ../drivers/gpu/drm/nouveau/nvif/outp.c: In function 'nvif_outp_acquire_dp': ../include/linux/fortify-string.h:57:33: warning: array subscript 'unsigned char[16][0]' is partly outside array bounds of 'u8[15]' {aka 'unsigned char[15]'} [-Warray-bounds=] 57 | #define __underlying_memcpy __builtin_memcpy | ^ ... ../drivers/gpu/drm/nouveau/nvif/outp.c:140:9: note: in expansion of macro 'memcpy' 140 | memcpy(args.dp.dpcd, dpcd, sizeof(args.dp.dpcd)); | ^~~~~~ ../drivers/gpu/drm/nouveau/nvif/outp.c:130:49: note: object 'dpcd' of size [0, 15] 130 | nvif_outp_acquire_dp(struct nvif_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE], | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 8134437 ("drm/nouveau/disp: move DP link config into acquire") Cc: Ben Skeggs <[email protected]> Cc: Lyude Paul <[email protected]> Cc: Karol Herbst <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: Dave Airlie <[email protected]> Cc: "Gustavo A. R. Silva" <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Reviewed-by: Karol Herbst <[email protected]> Signed-off-by: Karol Herbst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 0d68683 commit 25feda6

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

drivers/gpu/drm/nouveau/include/nvif/if0012.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef __NVIF_IF0012_H__
33
#define __NVIF_IF0012_H__
44

5+
#include <drm/display/drm_dp.h>
6+
57
union nvif_outp_args {
68
struct nvif_outp_v0 {
79
__u8 version;
@@ -63,7 +65,7 @@ union nvif_outp_acquire_args {
6365
__u8 hda;
6466
__u8 mst;
6567
__u8 pad04[4];
66-
__u8 dpcd[16];
68+
__u8 dpcd[DP_RECEIVER_CAP_SIZE];
6769
} dp;
6870
};
6971
} v0;

drivers/gpu/drm/nouveau/nvkm/engine/disp/outp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#define __NVKM_DISP_OUTP_H__
44
#include "priv.h"
55

6+
#include <drm/display/drm_dp.h>
67
#include <subdev/bios.h>
78
#include <subdev/bios/dcb.h>
89
#include <subdev/bios/dp.h>
@@ -42,7 +43,7 @@ struct nvkm_outp {
4243
bool aux_pwr_pu;
4344
u8 lttpr[6];
4445
u8 lttprs;
45-
u8 dpcd[16];
46+
u8 dpcd[DP_RECEIVER_CAP_SIZE];
4647

4748
struct {
4849
int dpcd; /* -1, or index into SUPPORTED_LINK_RATES table */

drivers/gpu/drm/nouveau/nvkm/engine/disp/uoutp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ nvkm_uoutp_mthd_release(struct nvkm_outp *outp, void *argv, u32 argc)
146146
}
147147

148148
static int
149-
nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[16],
149+
nvkm_uoutp_mthd_acquire_dp(struct nvkm_outp *outp, u8 dpcd[DP_RECEIVER_CAP_SIZE],
150150
u8 link_nr, u8 link_bw, bool hda, bool mst)
151151
{
152152
int ret;

0 commit comments

Comments
 (0)