fat: gcc 4.3 warning fix
This patch fixes the following warnings. fs/fat/dir.c: In function 'fat_parse_long': include/linux/msdos_fs.h:294: warning: array subscript is above array bounds include/linux/msdos_fs.h:295: warning: array subscript is above array bounds include/linux/msdos_fs.h:295: warning: array subscript is above array bounds The ->name is defined as "name[8], ext[3]", but fat_checksum() uses those as name[11]. There is no actual problem, but it's not a good manner. Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Родитель
259902ea95
Коммит
9aacd59934
31
fs/fat/dir.c
31
fs/fat/dir.c
|
@ -313,7 +313,7 @@ int fat_search_long(struct inode *inode, const unsigned char *name,
|
||||||
wchar_t bufuname[14];
|
wchar_t bufuname[14];
|
||||||
unsigned char xlate_len, nr_slots;
|
unsigned char xlate_len, nr_slots;
|
||||||
wchar_t *unicode = NULL;
|
wchar_t *unicode = NULL;
|
||||||
unsigned char work[8], bufname[260]; /* 256 + 4 */
|
unsigned char work[MSDOS_NAME], bufname[260]; /* 256 + 4 */
|
||||||
int uni_xlate = sbi->options.unicode_xlate;
|
int uni_xlate = sbi->options.unicode_xlate;
|
||||||
int utf8 = sbi->options.utf8;
|
int utf8 = sbi->options.utf8;
|
||||||
int anycase = (sbi->options.name_check != 's');
|
int anycase = (sbi->options.name_check != 's');
|
||||||
|
@ -351,7 +351,8 @@ parse_record:
|
||||||
if (work[0] == 0x05)
|
if (work[0] == 0x05)
|
||||||
work[0] = 0xE5;
|
work[0] = 0xE5;
|
||||||
for (i = 0, j = 0, last_u = 0; i < 8;) {
|
for (i = 0, j = 0, last_u = 0; i < 8;) {
|
||||||
if (!work[i]) break;
|
if (!work[i])
|
||||||
|
break;
|
||||||
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
|
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
|
||||||
&bufuname[j++], opt_shortname,
|
&bufuname[j++], opt_shortname,
|
||||||
de->lcase & CASE_LOWER_BASE);
|
de->lcase & CASE_LOWER_BASE);
|
||||||
|
@ -365,13 +366,15 @@ parse_record:
|
||||||
}
|
}
|
||||||
j = last_u;
|
j = last_u;
|
||||||
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
|
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
|
||||||
for (i = 0; i < 3;) {
|
for (i = 8; i < MSDOS_NAME;) {
|
||||||
if (!de->ext[i]) break;
|
if (!work[i])
|
||||||
chl = fat_shortname2uni(nls_disk, &de->ext[i], 3 - i,
|
break;
|
||||||
|
chl = fat_shortname2uni(nls_disk, &work[i],
|
||||||
|
MSDOS_NAME - i,
|
||||||
&bufuname[j++], opt_shortname,
|
&bufuname[j++], opt_shortname,
|
||||||
de->lcase & CASE_LOWER_EXT);
|
de->lcase & CASE_LOWER_EXT);
|
||||||
if (chl <= 1) {
|
if (chl <= 1) {
|
||||||
if (de->ext[i] != ' ')
|
if (work[i] != ' ')
|
||||||
last_u = j;
|
last_u = j;
|
||||||
} else {
|
} else {
|
||||||
last_u = j;
|
last_u = j;
|
||||||
|
@ -445,7 +448,7 @@ static int __fat_readdir(struct inode *inode, struct file *filp, void *dirent,
|
||||||
int fill_len;
|
int fill_len;
|
||||||
wchar_t bufuname[14];
|
wchar_t bufuname[14];
|
||||||
wchar_t *unicode = NULL;
|
wchar_t *unicode = NULL;
|
||||||
unsigned char c, work[8], bufname[56], *ptname = bufname;
|
unsigned char c, work[MSDOS_NAME], bufname[56], *ptname = bufname;
|
||||||
unsigned long lpos, dummy, *furrfu = &lpos;
|
unsigned long lpos, dummy, *furrfu = &lpos;
|
||||||
int uni_xlate = sbi->options.unicode_xlate;
|
int uni_xlate = sbi->options.unicode_xlate;
|
||||||
int isvfat = sbi->options.isvfat;
|
int isvfat = sbi->options.isvfat;
|
||||||
|
@ -527,7 +530,8 @@ parse_record:
|
||||||
if (work[0] == 0x05)
|
if (work[0] == 0x05)
|
||||||
work[0] = 0xE5;
|
work[0] = 0xE5;
|
||||||
for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) {
|
for (i = 0, j = 0, last = 0, last_u = 0; i < 8;) {
|
||||||
if (!(c = work[i])) break;
|
if (!(c = work[i]))
|
||||||
|
break;
|
||||||
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
|
chl = fat_shortname2uni(nls_disk, &work[i], 8 - i,
|
||||||
&bufuname[j++], opt_shortname,
|
&bufuname[j++], opt_shortname,
|
||||||
de->lcase & CASE_LOWER_BASE);
|
de->lcase & CASE_LOWER_BASE);
|
||||||
|
@ -549,9 +553,10 @@ parse_record:
|
||||||
j = last_u;
|
j = last_u;
|
||||||
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
|
fat_short2uni(nls_disk, ".", 1, &bufuname[j++]);
|
||||||
ptname[i++] = '.';
|
ptname[i++] = '.';
|
||||||
for (i2 = 0; i2 < 3;) {
|
for (i2 = 8; i2 < MSDOS_NAME;) {
|
||||||
if (!(c = de->ext[i2])) break;
|
if (!(c = work[i2]))
|
||||||
chl = fat_shortname2uni(nls_disk, &de->ext[i2], 3 - i2,
|
break;
|
||||||
|
chl = fat_shortname2uni(nls_disk, &work[i2], MSDOS_NAME - i2,
|
||||||
&bufuname[j++], opt_shortname,
|
&bufuname[j++], opt_shortname,
|
||||||
de->lcase & CASE_LOWER_EXT);
|
de->lcase & CASE_LOWER_EXT);
|
||||||
if (chl <= 1) {
|
if (chl <= 1) {
|
||||||
|
@ -563,8 +568,8 @@ parse_record:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
last_u = j;
|
last_u = j;
|
||||||
for (chi = 0; chi < chl && i2 < 3; chi++) {
|
for (chi = 0; chi < chl && i2 < MSDOS_NAME; chi++) {
|
||||||
ptname[i++] = de->ext[i2++];
|
ptname[i++] = work[i2++];
|
||||||
last = i;
|
last = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -354,8 +354,7 @@ static int fat_fill_inode(struct inode *inode, struct msdos_dir_entry *de)
|
||||||
} else { /* not a directory */
|
} else { /* not a directory */
|
||||||
inode->i_generation |= 1;
|
inode->i_generation |= 1;
|
||||||
inode->i_mode = MSDOS_MKMODE(de->attr,
|
inode->i_mode = MSDOS_MKMODE(de->attr,
|
||||||
((sbi->options.showexec &&
|
((sbi->options.showexec && !is_exec(de->name + 8))
|
||||||
!is_exec(de->ext))
|
|
||||||
? S_IRUGO|S_IWUGO : S_IRWXUGO)
|
? S_IRUGO|S_IWUGO : S_IRWXUGO)
|
||||||
& ~sbi->options.fs_fmask) | S_IFREG;
|
& ~sbi->options.fs_fmask) | S_IFREG;
|
||||||
MSDOS_I(inode)->i_start = le16_to_cpu(de->start);
|
MSDOS_I(inode)->i_start = le16_to_cpu(de->start);
|
||||||
|
|
|
@ -146,7 +146,7 @@ struct fat_boot_fsinfo {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct msdos_dir_entry {
|
struct msdos_dir_entry {
|
||||||
__u8 name[8],ext[3]; /* name and extension */
|
__u8 name[MSDOS_NAME];/* name and extension */
|
||||||
__u8 attr; /* attribute bits */
|
__u8 attr; /* attribute bits */
|
||||||
__u8 lcase; /* Case for base and extension */
|
__u8 lcase; /* Case for base and extension */
|
||||||
__u8 ctime_cs; /* Creation time, centiseconds (0-199) */
|
__u8 ctime_cs; /* Creation time, centiseconds (0-199) */
|
||||||
|
|
Загрузка…
Ссылка в новой задаче