svn commit: r335366 - head/sys/cam/mmc
Ilya Bakulin
kibab at FreeBSD.org
Tue Jun 19 11:25:41 UTC 2018
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,
More information about the svn-src-all
mailing list