From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753902AbdARO2V (ORCPT ); Wed, 18 Jan 2017 09:28:21 -0500 Received: from mout.web.de ([217.72.192.78]:58215 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751997AbdARO2T (ORCPT ); Wed, 18 Jan 2017 09:28:19 -0500 Subject: Re: [PATCH 4/4] alpha: Move two assignments for the variable "res" in srm_env_proc_write() To: Jan-Benedict Glaw , linux-alpha@vger.kernel.org References: <986573fa-e636-f864-14dc-5e65a31b454e@users.sourceforge.net> <20170118131429.GA12614@lug-owl.de> Cc: Al Viro , Ivan Kokshaysky , Matt Turner , Nicolas Pitre , Richard Cochran , Richard Henderson , Thomas Gleixner , LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <50d6acaf-e34f-557f-46b6-b182fb9a441a@users.sourceforge.net> Date: Wed, 18 Jan 2017 15:27:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: <20170118131429.GA12614@lug-owl.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:QcDFO6A+Zv62HmtF+Tjz8EZkC0KtMhoLCIHOoLV3MsQeEzVzVMv vLnukUx3aSsb6kmWKgcpfX2X9EBZ+d2p64cyUIXwjGBdtqZhnXlmM7iM/mFgdODQO0BwqCu GiwNPB6lmm3h0jYoB/knIlm8KPm2ytOUYqmQCSFbAqQC0FydCoznTs5F4DaV/bgYlQqZnKY mG6bqxkfZPOcSAuV6tKCQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:k+kM5hVRH1M=:Sl9TgZQhsz7CoBBOPufEAF KlSoDomXeFuWshQUhl0KcSh4ihpEFK4I9eCW2zfiU+SwHAKM9N/Y50JTNmmpbxhjL5IO3QgTb fN0hbl8W9F/Ruprue8uoqI6ruKPW6CJD3/id008nU/mbVv5uWL7CE9t8X6g7oVHGPF9ED2UUD pnNmf3ReJYj9c+WPkn6dB8cTp8b58mi6o4M1oS0XN1YDKD1py9t0yTliSMx6/WoVTl5gVu/FO k6zmnJuMmCWI304fJIzRl9JFZ5vXUUZF3OSYnCHq7dhL6hMrCdahv6996guaKHtRGwz4QwjYc CvGMPoaMfOtMMhy0DXIS3bzvqKgnbqvV7RSNl1402BTqfMiMgsQCO6ksdbFYouEGPC3G9WgXZ 6TryHMvOOpJbUQ4I8jzYYW3BlDEYga9jMt0ZgFMGdKN+eW8KiksYmBXe6smyN3LRiYGMrUed2 JOnCib5oOofVREmJ7ZV+DK1n8+3e+QqvIfrdvehtErum6WKsb/x3M1Ew1aqFZMuHEQoQI4MPK FWt4kPPrtCnSrJBx/nlagO3xSvCOOLkfPtN6u9A0rvANuFSwOXBxDCyEA3pxC+GAczyEq8gKA ivbmYOjKQUnVFHSU1AtiX1Sp7VwhVboMUvjUByhl677ANyWUdSAtxYuON54A8rAAUOacpYZzk k+WIeu6lQdedE6t0QeOIsDUPUdl81Be8VtOeOHN/7oEp97OKk/8SxxcqXnSGOxGaueiFn8DC6 tDwQABc4iQrpf7HPC7air6bn9vl6wsxY8rWH8KpflK1tZ8QqY0ZvD42adHtT231JxTcyUmEyG AB/nVYF Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org >> 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 > Acked-by: Jan-Benedict Glaw 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