Date: Tue, 19 Jun 2018 11:25:40 +0000 (UTC) From: Ilya Bakulin <kibab@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r335366 - head/sys/cam/mmc Message-ID: <201806191125.w5JBPe5X024223@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kibab Date: Tue Jun 19 11:25:40 2018 New Revision: 335366 URL: https://svnweb.freebsd.org/changeset/base/335366 Log: Correctly define rawscr so initializing it doesn't result in overwriting memory. We need 8 bytes of storage for rawscr. Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D15889 Modified: head/sys/cam/mmc/mmc_da.c Modified: head/sys/cam/mmc/mmc_da.c ============================================================================== --- head/sys/cam/mmc/mmc_da.c Tue Jun 19 11:23:48 2018 (r335365) +++ head/sys/cam/mmc/mmc_da.c Tue Jun 19 11:25:40 2018 (r335366) @@ -818,6 +818,7 @@ mmc_app_get_scr(struct cam_periph *periph, union ccb * struct mmc_data d; memset(&cmd, 0, sizeof(cmd)); + memset(&d, 0, sizeof(d)); memset(rawscr, 0, 8); cmd.opcode = ACMD_SEND_SCR; @@ -1296,13 +1297,13 @@ sdda_start_init(void *context, union ccb *start_ccb) /* Find out if the card supports High speed timing */ if (mmcp->card_features & CARD_FEATURE_SD20) { /* Get and decode SCR */ - uint32_t rawscr; + uint32_t rawscr[2]; uint8_t res[64]; - if (mmc_app_get_scr(periph, start_ccb, &rawscr)) { + if (mmc_app_get_scr(periph, start_ccb, rawscr)) { CAM_DEBUG(periph->path, CAM_DEBUG_PERIPH, ("Cannot get SCR\n")); goto finish_hs_tests; } - mmc_app_decode_scr(&rawscr, &softc->scr); + mmc_app_decode_scr(rawscr, &softc->scr); if ((softc->scr.sda_vsn >= 1) && (softc->csd.ccc & (1<<10))) { mmc_sd_switch(periph, start_ccb, SD_SWITCH_MODE_CHECK,
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806191125.w5JBPe5X024223>