* asdf
@ 2011-12-06 8:08 Dan Carpenter
2011-12-06 8:15 ` uninitialized variable in mmc_blk_issue_secdiscard_rq() Dan Carpenter
2011-12-06 8:48 ` asdf Kyungmin Park
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-12-06 8:08 UTC (permalink / raw)
To: Kyungmin Park, Adrian Hunter; +Cc: linux-mmc
There is a new gcc warning in this function:
drivers/mmc/card/block.c:836:18: warning: ‘arg’ may be used uninitialized in this function [-Wuninitialized]
810 /* The sanitize operation is supported at v4.5 only */
811 if (mmc_can_sanitize(card)) {
812 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
813 EXT_CSD_SANITIZE_START, 1, 0);
1) arg is uninitialized here. mmc_switch() can return -EIO.
814 goto out;
815 }
816
817 from = blk_rq_pos(req);
818 nr = blk_rq_sectors(req);
819
820 if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr))
821 arg = MMC_SECURE_TRIM1_ARG;
822 else
823 arg = MMC_SECURE_ERASE_ARG;
824 retry:
825 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
826 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
827 INAND_CMD38_ARG_EXT_CSD,
828 arg == MMC_SECURE_TRIM1_ARG ?
^^^
3) uninitialized.
829 INAND_CMD38_ARG_SECTRIM1 :
830 INAND_CMD38_ARG_SECERASE,
831 0);
832 if (err)
833 goto out;
834 }
835 err = mmc_erase(card, from, nr, arg);
836 if (!err && arg == MMC_SECURE_TRIM1_ARG) {
837 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
838 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
839 INAND_CMD38_ARG_EXT_CSD,
840 INAND_CMD38_ARG_SECTRIM2,
841 0);
842 if (err)
843 goto out;
844 }
845 err = mmc_erase(card, from, nr, MMC_SECURE_TRIM2_ARG);
846 }
847 out:
848 if (err == -EIO && !mmc_blk_reset(md, card->host, type))
849 goto retry;
2) We could maybe hit the goto retry here if the reset works.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: uninitialized variable in mmc_blk_issue_secdiscard_rq()
2011-12-06 8:08 asdf Dan Carpenter
@ 2011-12-06 8:15 ` Dan Carpenter
2011-12-06 8:48 ` asdf Kyungmin Park
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2011-12-06 8:15 UTC (permalink / raw)
To: Kyungmin Park, Adrian Hunter; +Cc: linux-mmc
[-- Attachment #1: Type: text/plain, Size: 600 bytes --]
On Tue, Dec 06, 2011 at 11:08:59AM +0300, Dan Carpenter wrote:
> There is a new gcc warning in this function:
>
> drivers/mmc/card/block.c:836:18: warning: ‘arg’ may be used uninitialized in this function [-Wuninitialized]
>
Sorry for the bad subject. The email escaped before it should have.
Same thing for "nr" and "from".
drivers/mmc/card/block.c:835:6: warning: ‘nr’ may be used uninitialized in this function [-Wuninitialized]
drivers/mmc/card/block.c:835:6: warning: ‘from’ may be used uninitialized in this function [-Wuninitialized]
regards,
dan carpenter
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: asdf
2011-12-06 8:08 asdf Dan Carpenter
2011-12-06 8:15 ` uninitialized variable in mmc_blk_issue_secdiscard_rq() Dan Carpenter
@ 2011-12-06 8:48 ` Kyungmin Park
1 sibling, 0 replies; 3+ messages in thread
From: Kyungmin Park @ 2011-12-06 8:48 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Adrian Hunter, linux-mmc
Hi
Yes possible scenario, it should be changed like this.
out:
if (err == -EIO) {
int ret = !mmc_blk_reset(md, card->host, type);
if (ret && !mmc_can_sanitize(card))
goto retry;
}
anyway, I will find the more fancy way.
Thank you for pointing out.
BR,
Kyungmin Park
On 12/6/11, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> There is a new gcc warning in this function:
>
> drivers/mmc/card/block.c:836:18: warning: ‘arg’ may be used uninitialized in
> this function [-Wuninitialized]
>
> 810 /* The sanitize operation is supported at v4.5 only */
> 811 if (mmc_can_sanitize(card)) {
> 812 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> 813 EXT_CSD_SANITIZE_START, 1, 0);
>
> 1) arg is uninitialized here. mmc_switch() can return -EIO.
>
> 814 goto out;
> 815 }
> 816
> 817 from = blk_rq_pos(req);
> 818 nr = blk_rq_sectors(req);
> 819
> 820 if (mmc_can_trim(card) && !mmc_erase_group_aligned(card,
> from, nr))
> 821 arg = MMC_SECURE_TRIM1_ARG;
> 822 else
> 823 arg = MMC_SECURE_ERASE_ARG;
> 824 retry:
> 825 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
> 826 err = mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
> 827 INAND_CMD38_ARG_EXT_CSD,
> 828 arg == MMC_SECURE_TRIM1_ARG ?
> ^^^
>
> 3) uninitialized.
>
> 829 INAND_CMD38_ARG_SECTRIM1 :
> 830 INAND_CMD38_ARG_SECERASE,
> 831 0);
> 832 if (err)
> 833 goto out;
> 834 }
> 835 err = mmc_erase(card, from, nr, arg);
> 836 if (!err && arg == MMC_SECURE_TRIM1_ARG) {
> 837 if (card->quirks & MMC_QUIRK_INAND_CMD38) {
> 838 err = mmc_switch(card,
> EXT_CSD_CMD_SET_NORMAL,
> 839 INAND_CMD38_ARG_EXT_CSD,
> 840 INAND_CMD38_ARG_SECTRIM2,
> 841 0);
> 842 if (err)
> 843 goto out;
> 844 }
> 845 err = mmc_erase(card, from, nr,
> MMC_SECURE_TRIM2_ARG);
> 846 }
> 847 out:
> 848 if (err == -EIO && !mmc_blk_reset(md, card->host, type))
> 849 goto retry;
>
> 2) We could maybe hit the goto retry here if the reset works.
>
> regards,
> dan carpenter
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-06 8:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-06 8:08 asdf Dan Carpenter
2011-12-06 8:15 ` uninitialized variable in mmc_blk_issue_secdiscard_rq() Dan Carpenter
2011-12-06 8:48 ` asdf Kyungmin Park
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox