Skip to contentSkip to conversation

drm/nouveau: fix array overflow

PATCH In review Pekka Paalanen 2 participants 2 messages Dec 5, 2009 – Dec 6, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/nouveau: fix array overflow

Noticed by sparse: in nouveau_dp_link_train(), the array 'status' was defined as 2 bytes, yet it was accessed for 3 bytes.

Fix it by making the array size 3.

---
 drivers/gpu/drm/nouveau/nouveau_dp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dp.c +2 -1
index a334f17..c2d6eff 100644
@@ -271,7 +271,8 @@ nouveau_dp_link_train(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
-	uint8_t config[4], status[2];
+	uint8_t config[4];
+	uint8_t status[3];
 	bool cr_done, cr_max_vs, eq_done;
 	int ret = 0, i, tries, voltage;
 
Signature · 1 line
1.6.4.4

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 4 lines · Pekka Paalanen

Noticed by sparse: in nouveau_dp_link_train(), the array 'status' was defined as 2 bytes, yet it was accessed for 3 bytes.

Fix it by making the array size 3.

Thanks, pushed. Though, for obvious things like this just commit away :)

Ben.

Quoted 20 lines
---
 drivers/gpu/drm/nouveau/nouveau_dp.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/gpu/drm/nouveau/nouveau_dp.c +2 -1
index a334f17..c2d6eff 100644
@@ -271,7 +271,8 @@ nouveau_dp_link_train(struct drm_encoder *encoder)
 {
 	struct drm_device *dev = encoder->dev;
 	struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
-	uint8_t config[4], status[2];
+	uint8_t config[4];
+	uint8_t status[3];
 	bool cr_done, cr_max_vs, eq_done;
 	int ret = 0, i, tries, voltage;