Re: [PATCH] MMC: Fix use of uninitialized data in mmc_cmd_app.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 13 Apr 2011, Andrei Warkentin wrote:

> mmc_cmd_app did not zero out mmc_command on stack.
> 
> Signed-off-by: Andrei Warkentin <andreiw@xxxxxxxxxxxx>
> ---
>  drivers/mmc/core/sd_ops.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/mmc/core/sd_ops.c b/drivers/mmc/core/sd_ops.c
> index 76af349..71fdb07 100644
> --- a/drivers/mmc/core/sd_ops.c
> +++ b/drivers/mmc/core/sd_ops.c
> @@ -29,6 +29,8 @@ static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
>  	BUG_ON(!host);
>  	BUG_ON(card && (card->host != host));
>  
> +	memset(&cmd, 0, sizeof(struct mmc_command));
> +
>  	cmd.opcode = MMC_APP_CMD;
>  
>  	if (card) {
> -- 

Out of curiosity, why is:

	memset(&cmd, 0, sizeof(struct mmc_command));

preferred over:

	struct mmc_command cmd = {0};


John
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux