From mboxrd@z Thu Jan 1 00:00:00 1970 From: keith.busch@intel.com (Keith Busch) Date: Fri, 1 Mar 2013 15:05:06 -0700 (MST) Subject: [PATCH 2/2] Return the result from user admin command IOCTL even in case of failureX In-Reply-To: References: Message-ID: On Thu, 28 Feb 2013, Chayan Biswas wrote: > - if (!status && copy_to_user(&ucmd->result, &cmd.result, > - sizeof(cmd.result))) > + if (copy_to_user(&ucmd->result, &cmd.result, sizeof(cmd.result))) > status = -EFAULT; I think you want to change this to a check for 'status >= 0' before copying the result to the user since a status < 0 means the command was not completed by the controller (successfully or otherwise) and you'd be copying uninitialized data to the user in that case.