system/corennnnn
Revision | e5d5a575676815c762b5954eac773a04066618ff (tree) |
---|---|
Time | 2010-04-14 19:12:28 |
Author | Xinyu Chen <xinyu.chen@free...> |
Commiter | Chih-Wei Huang |
Fix bug of mmc.c not checking read_file result.
This bug causes segment fault when reading name node of
SDIO mmc device's /sys file, which is not existed at all.
Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
@@ -158,6 +158,10 @@ static int mmc_bootstrap_card(char *sysfs_path) | ||
158 | 158 | |
159 | 159 | sprintf(filename, "/sys%s/name", devpath); |
160 | 160 | p = read_file(filename, &sz); |
161 | + if (!p) { | |
162 | + LOGE("Unable to read MMC name: %s", filename); | |
163 | + return -errno; | |
164 | + } | |
161 | 165 | p[strlen(p) - 1] = '\0'; |
162 | 166 | sprintf(tmp, "MMC_NAME=%s", p); |
163 | 167 | free(p); |