lkml.org 
[lkml]   [2016]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 16/17] s390/debug: Improve determination of sizes in debug_info_alloc()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Fri, 2 Sep 2016 14:39:00 +0200

    * Replace two multiplications by references for an array in a local
    data structure as the parameter for the operator "sizeof" to make
    the corresponding size determination a bit safer.

    * Improve source code layout for one function call.

    Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
    ---
    arch/s390/kernel/debug.c | 5 ++---
    1 file changed, 2 insertions(+), 3 deletions(-)

    diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
    index ff8e705..408a8da 100644
    --- a/arch/s390/kernel/debug.c
    +++ b/arch/s390/kernel/debug.c
    @@ -269,9 +269,8 @@ debug_info_alloc(const char *name, int pages_per_area, int nr_areas,
    rc->buf_size = buf_size;
    rc->entry_size = sizeof(debug_entry_t) + buf_size;
    strlcpy(rc->name, name, sizeof(rc->name));
    - memset(rc->views, 0, DEBUG_MAX_VIEWS * sizeof(struct debug_view *));
    - memset(rc->debugfs_entries, 0, DEBUG_MAX_VIEWS *
    - sizeof(struct dentry*));
    + memset(rc->views, 0, sizeof(rc->views));
    + memset(rc->debugfs_entries, 0, sizeof(rc->debugfs_entries));
    atomic_set(&(rc->ref_count), 0);

    return rc;
    --
    2.9.3
    \
     
     \ /
      Last update: 2016-09-17 09:58    [W:4.049 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site