Re: [PATCH 4/4] alpha: Move two assignments for the variable "res" in srm_env_proc_write()
From: SF Markus Elfring
Date: Wed Jan 18 2017 - 09:28:20 EST
>> A local variable was set to an error code in two cases 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@xxxxxxxxxxxxxxxxxxxxx>
> Acked-by: Jan-Benedict Glaw <jbglaw@xxxxxxxxxx>
Thanks for your positive feedback.
Unfortunately, I have got the impression that this update step is inappropriate
so far because the suggested change for the handling of the error code â-EFAULTâ
can be incomplete (or a bit too much).
Which implementation would you prefer?
A) Keep the variable assignment before the check for the call of
the function âcopy_from_userâ
B) Add an assignment in another condition branch at the end.
res = (int) ret1;
+ } else {
+ res = -EFAULT;
}
Regards,
Markus
--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html