lkml.org 
[lkml]   [2016]   [Sep]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 01/14] GPU-DRM-OMAP: Use kmalloc_array() in tiler_map_show()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Wed, 21 Sep 2016 12:23:46 +0200

    A multiplication for the size determination of a memory allocation
    indicated that an array data structure should be processed.
    Thus use the corresponding function "kmalloc_array".

    This issue was detected by using the Coccinelle software.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    drivers/gpu/drm/omapdrm/omap_dmm_tiler.c | 3 +--
    1 file changed, 1 insertion(+), 2 deletions(-)

    diff --git a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
    index 4ceed7a9..7b32dd3 100644
    --- a/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
    +++ b/drivers/gpu/drm/omapdrm/omap_dmm_tiler.c
    @@ -917,8 +917,7 @@ int tiler_map_show(struct seq_file *s, void *arg)

    h_adj = omap_dmm->container_height / ydiv;
    w_adj = omap_dmm->container_width / xdiv;
    -
    - map = kmalloc(h_adj * sizeof(*map), GFP_KERNEL);
    + map = kmalloc_array(h_adj, sizeof(*map), GFP_KERNEL);
    global_map = kmalloc((w_adj + 1) * h_adj, GFP_KERNEL);

    if (!map || !global_map)
    --
    2.10.0
    \
     
     \ /
      Last update: 2016-09-22 23:59    [W:4.016 / U:0.436 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site