: nouveau and radeon checkstack fixes
Subsystems (4)
PATCH 1/1 : nouveau and radeon checkstack fixes
Fixes linux-next & linux-2.6 checkstack warnings:
drivers/gpu/drm/nouveau/nv40_graph.c: In function `nv40_graph_init':drivers/gpu/drm/nouveau/nv40_graph.c:400: warning: the frame size of 1184 bytes is larger than 1024 bytes drivers/gpu/drm/radeon/radeon_atombios.c: In function `radeon_get_atom_connector_info_from_supported_devices_table':drivers/gpu/drm/radeon/radeon_atombios.c:857: warning: the frame size of 1872 bytes is larger than 1024 bytes
drivers/gpu/drm/nouveau/nv40_graph.c +7 -1
@@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev)if (!dev_priv->engine.graph.ctxprog) {struct nouveau_grctx ctx = {}; -uint32_t cp[256 ]; +uint32_t *cp; + + cp =kmalloc (sizeof (*cp),GFP_KERNEL ); +if (!cp) +return -ENOMEM ; ctx.dev = dev; ctx.mode =NOUVEAU_GRCTX_PROG ;
@@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_INDEX ,0 );for (i =0 ; i < ctx.ctxprog_len; i++)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_DATA , cp[i]); + +kfree (cp); }/* No context present currently */
drivers/gpu/drm/radeon/radeon_atombios.c +11 -2
@@ -682,10 +682,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structuint8_t dac;union atom_supported_devices *supported_devices;int i, j, max_device; -struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE ]; +struct bios_connector *bios_connectors; +size_t bc_size =sizeof (*bios_connectors) *ATOM_MAX_SUPPORTED_DEVICE ; -if (!atom_parse_data_header (ctx, index, &size, &frev, &crev, &data_offset)) + bios_connectors =kzalloc (bc_size,GFP_KERNEL ); +if (!bios_connectors) +return false; + +if (!atom_parse_data_header (ctx, index, &size, &frev, &crev, + &data_offset)) { +kfree (bios_connectors);return false; + } supported_devices = (union atom_supported_devices *)(ctx->bios + data_offset);
@@ -853,6 +861,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structradeon_link_encoder_connector (dev); +kfree (bios_connectors);return true; }
Quoted 14 lines · Prarit Bhargava
Fixes linux-next & linux-2.6 checkstack warnings:
drivers/gpu/drm/nouveau/nv40_graph.c: In function `nv40_graph_init':drivers/gpu/drm/nouveau/nv40_graph.c:400: warning: the frame size of 1184 bytes is larger than 1024 bytesdrivers/gpu/drm/radeon/radeon_atombios.c: In function `radeon_get_atom_connector_info_from_supported_devices_table':drivers/gpu/drm/radeon/radeon_atombios.c:857: warning: the frame size of 1872 bytes is larger than 1024 bytesSigned-off-by Prarit Bhargava <[email protected]>drivers/gpu/drm/nouveau/nv40_graph.c +0
-0
drivers/gpu/drm/nouveau/nv40_graph.c nv40_graph_init(struct drm_device *dev) · line 261
Quoted 10 lines
drivers/gpu/drm/nouveau/nv40_graph.c +5
-1@@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev) if (!dev_priv->engine.graph.ctxprog) { struct nouveau_grctx ctx = {}; - uint32_t cp[256]; + uint32_t *cp; + + cp = kmalloc(sizeof(*cp), GFP_KERNEL); + if (!cp) + return -ENOMEM;
This seems wrong, allocating 1 uint32_t isn't enough.
Quoted 49 lines
drivers/gpu/drm/nouveau/nv40_graph.c +2
-0ctx.dev = dev; ctx.mode = NOUVEAU_GRCTX_PROG;@@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev) nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_INDEX, 0); for (i = 0; i < ctx.ctxprog_len; i++) nv_wr32(dev, NV40_PGRAPH_CTXCTL_UCODE_DATA, cp[i]); + + kfree(cp); } /* No context present currently */drivers/gpu/drm/radeon/radeon_atombios.c +10
-2@@ -682,10 +682,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct uint8_t dac; union atom_supported_devices *supported_devices; int i, j, max_device; - struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE]; + struct bios_connector *bios_connectors; + size_t bc_size = sizeof(*bios_connectors) * ATOM_MAX_SUPPORTED_DEVICE; - if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset)) + bios_connectors = kzalloc(bc_size, GFP_KERNEL); + if (!bios_connectors) + return false; + + if (!atom_parse_data_header(ctx, index, &size, &frev, &crev, + &data_offset)) { + kfree(bios_connectors); return false; + }supported_devices =
(unionatom_supported_devices*)(ctx->bios +data_offset);drivers/gpu/drm/radeon/radeon_atombios.c +1
-0@@ -853,6 +861,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct radeon_link_encoder_connector(dev); + kfree(bios_connectors); return true; }_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 17 lines · Maarten Maathuis
Quoted 15 lines · Prarit Bhargava
Fixes linux-next& linux-2.6 checkstack warnings:
drivers/gpu/drm/nouveau/nv40_graph.c: In function `nv40_graph_init':drivers/gpu/drm/nouveau/nv40_graph.c:400: warning: the frame size of 1184 bytes is larger than 1024 bytesdrivers/gpu/drm/radeon/radeon_atombios.c: In function `radeon_get_atom_connector_info_from_supported_devices_table':drivers/gpu/drm/radeon/radeon_atombios.c:857: warning: the frame size of 1872 bytes is larger than 1024 bytesSigned-off-by Prarit Bhargava<[email protected]>drivers/gpu/drm/nouveau/nv40_graph.c +0
-0@@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev)
Quoted 12 lines
drivers/gpu/drm/nouveau/nv40_graph.c nv40_graph_init(struct drm_device *dev) · line 262
Quoted 10 lines
drivers/gpu/drm/nouveau/nv40_graph.c +5
-1if (!dev_priv->engine.graph.ctxprog) {struct nouveau_grctx ctx = {}; -uint32_t cp[256 ]; +uint32_t *cp; + + cp =kmalloc (sizeof (*cp),GFP_KERNEL ); +if (!cp) +return -ENOMEM ;This seems wrong, allocating 1
uint32_tisn't enough.
Oops! That obviously should have been (sizeof(*cp) * 256) ... New patch.
Thanks Maarten,
P.
Quoted 45 lines
Quoted 45 lines
drivers/gpu/drm/nouveau/nv40_graph.c +0
-0ctx.dev = dev;ctx.mode = NOUVEAU_GRCTX_PROG;drivers/gpu/drm/nouveau/nv40_graph.c +2
-0@@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_INDEX ,0 );for (i =0 ; i< ctx.ctxprog_len; i++)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_DATA , cp[i]); + +kfree (cp); }/* No context present currently */ drivers/gpu/drm/radeon/radeon_atombios.c +11
-2@@ -682,10 +682,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structuint8_t dac;union atom_supported_devices *supported_devices;int i, j, max_device; -struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE ]; +struct bios_connector *bios_connectors; +size_t bc_size =sizeof (*bios_connectors) *ATOM_MAX_SUPPORTED_DEVICE ; -if (!atom_parse_data_header (ctx, index,&size,&frev,&crev,&data_offset)) + bios_connectors =kzalloc (bc_size,GFP_KERNEL ); +if (!bios_connectors) +return false; + +if (!atom_parse_data_header (ctx, index,&size,&frev,&crev, +&data_offset)) { +kfree (bios_connectors);return false; + } supported_devices = (union atom_supported_devices *)(ctx->bios + data_offset);@@ -853,6 +861,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structradeon_link_encoder_connector (dev); +kfree (bios_connectors);return true; }
Quoted 6 lines
Quoted 6 lines
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Fixes linux-next & linux-2.6 checkstack warnings:
drivers/gpu/drm/nouveau/nv40_graph.c: In function `nv40_graph_init':drivers/gpu/drm/nouveau/nv40_graph.c:400: warning: the frame size of 1184 bytes is larger than 1024 bytes drivers/gpu/drm/radeon/radeon_atombios.c: In function `radeon_get_atom_connector_info_from_supported_devices_table':drivers/gpu/drm/radeon/radeon_atombios.c:857: warning: the frame size of 1872 bytes is larger than 1024 bytes
drivers/gpu/drm/nouveau/nv40_graph.c +7 -1
@@ -253,7 +253,11 @@ nv40_graph_init(struct drm_device *dev)if (!dev_priv->engine.graph.ctxprog) {struct nouveau_grctx ctx = {}; -uint32_t cp[256 ]; +uint32_t *cp; + + cp =kmalloc (sizeof (*cp) *256 ,GFP_KERNEL ); +if (!cp) +return -ENOMEM ; ctx.dev = dev; ctx.mode =NOUVEAU_GRCTX_PROG ;
@@ -265,6 +269,8 @@ nv40_graph_init(struct drm_device *dev)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_INDEX ,0 );for (i =0 ; i < ctx.ctxprog_len; i++)nv_wr32 (dev,NV40_PGRAPH_CTXCTL_UCODE_DATA , cp[i]); + +kfree (cp); }/* No context present currently */
drivers/gpu/drm/radeon/radeon_atombios.c +11 -2
@@ -682,10 +682,18 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structuint8_t dac;union atom_supported_devices *supported_devices;int i, j, max_device; -struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE ]; +struct bios_connector *bios_connectors; +size_t bc_size =sizeof (*bios_connectors) *ATOM_MAX_SUPPORTED_DEVICE ; -if (!atom_parse_data_header (ctx, index, &size, &frev, &crev, &data_offset)) + bios_connectors =kzalloc (bc_size,GFP_KERNEL ); +if (!bios_connectors) +return false; + +if (!atom_parse_data_header (ctx, index, &size, &frev, &crev, + &data_offset)) { +kfree (bios_connectors);return false; + } supported_devices = (union atom_supported_devices *)(ctx->bios + data_offset);
@@ -853,6 +861,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(structradeon_link_encoder_connector (dev); +kfree (bios_connectors);return true; }
* Unmerged path localversion-next
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel