Description: code defect fix

Change-Id: I9c49073ad2bbd668102d20da8ff7a8d680890deb
This commit is contained in:
YOUR_NAME 2021-03-23 15:20:27 +08:00
parent 04820a2840
commit 63edd9afd1
1 changed files with 6 additions and 3 deletions

View File

@ -378,7 +378,7 @@ int fatfs_create(struct Vnode *parent, const char *name, int mode, struct Vnode
st_dword(dp->dir + DIR_ModTime, time); st_dword(dp->dir + DIR_ModTime, time);
st_word(dp->dir + DIR_LstAccDate, time >> FTIME_DATE_OFFSET); st_word(dp->dir + DIR_LstAccDate, time >> FTIME_DATE_OFFSET);
dp->dir[DIR_Attr] = AM_ARC; dp->dir[DIR_Attr] = AM_ARC;
if ((mode & S_IWUSR) == 0) { if (((DWORD)mode & S_IWUSR) == 0) {
dp->dir[DIR_Attr] |= AM_RDO; dp->dir[DIR_Attr] |= AM_RDO;
} }
st_clust(fs, dp->dir, 0); st_clust(fs, dp->dir, 0);
@ -894,6 +894,9 @@ static int fat_bind_check(struct Vnode *blk_driver, los_part **partition)
} }
part = los_part_find(blk_driver); part = los_part_find(blk_driver);
if (part == NULL) {
return ENODEV;
}
if (part->part_name != NULL) { if (part->part_name != NULL) {
bops->close(blk_driver); bops->close(blk_driver);
return EBUSY; return EBUSY;
@ -1180,7 +1183,7 @@ static inline int GET_YEAR(WORD fdate)
static time_t fattime_transfer(WORD fdate, WORD ftime) static time_t fattime_transfer(WORD fdate, WORD ftime)
{ {
struct tm time; struct tm time = { 0 };
time.tm_sec = GET_SECONDS(ftime); time.tm_sec = GET_SECONDS(ftime);
time.tm_min = GET_MINUTES(ftime); time.tm_min = GET_MINUTES(ftime);
time.tm_hour = GET_HOURS(ftime); time.tm_hour = GET_HOURS(ftime);
@ -1620,7 +1623,7 @@ int fatfs_mkfs (struct Vnode *device, int sectors, int option)
return -ENODEV; return -ENODEV;
} }
if (sectors < 0 || sectors > FAT32_MAX_CLUSTER_SIZE || (sectors & (sectors - 1))) { if (sectors < 0 || sectors > FAT32_MAX_CLUSTER_SIZE || ((DWORD)sectors & ((DWORD)sectors - 1))) {
return -EINVAL; return -EINVAL;
} }