lkml.org 
[lkml]   [2017]   [Jan]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH 4/5] cfq-iosched: Move an assignment for the variable "ret" in __cfqg_set_weight_device()
    From
    Date
    From: Markus Elfring <elfring@users.sourceforge.net>
    Date: Sat, 21 Jan 2017 22:26:38 +0100

    A local variable was set to an error code before a concrete error situation
    was detected. Thus move the corresponding assignment into an if branch
    to indicate a software failure there.

    This issue was detected by using the Coccinelle software.

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

    diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
    index c73a6fcaeb9d..454297fe8fd6 100644
    --- a/block/cfq-iosched.c
    +++ b/block/cfq-iosched.c
    @@ -1788,9 +1788,10 @@ static ssize_t __cfqg_set_weight_device(struct kernfs_open_file *of,

    if (sscanf(ctx.body, "%llu", &v) == 1) {
    /* require "default" on dfl */
    - ret = -ERANGE;
    - if (!v && on_dfl)
    + if (!v && on_dfl) {
    + ret = -ERANGE;
    goto out_finish;
    + }
    } else if (!strcmp(strim(ctx.body), "default")) {
    v = 0;
    } else {
    --
    2.11.0
    \
     
     \ /
      Last update: 2017-01-22 09:34    [W:2.556 / U:0.004 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site