Re: [patchv3 2/4] MMC: SDHCI R1B command handling + MMC_CAP_ERASE.

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

 



On Tue, Apr 12, 2011 at 8:59 PM, Dong, Chuanxiao
<chuanxiao.dong@xxxxxxxxx> wrote:

> Yes, if all the consumers of mmc_command memset the structure to 0, there will be no problem. But just reviewed the code, and found mmc_app_cmd() (in sd_ops.c) didn't memset the command structure. So I think if we can make sure all the command structures will be initialized before using it, that would be better.

I would say that CMD55 is not a command that utilizes the DAT line,
again, so not setting cmd_timeout itself is not a problem.

However, using uninitialized data is nasty, and can lead to problems
if cmd->data ever happens to be not NULL.
I'll send a patch for this tomorrow. Thanks for catching this. I'm
curious if this is the reason behind Cyril's problem.

Cyril can you try modifying mmc_app_cmd like this? Does that do
anything for you?

static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
{
        int err;
        struct mmc_command cmd;

        BUG_ON(!host);
        BUG_ON(card && (card->host != host));

+      memset(&cmd, 0, sizeof(struct mmc_command));
        cmd.opcode = MMC_APP_CMD;

A
--
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