diff for duplicates of <20120321053735.GO6589@ZenIV.linux.org.uk> diff --git a/a/1.txt b/N1/1.txt index 8b06e45..edf2629 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -36,7 +36,7 @@ Is it possible? > + goto out; > + } > + for (j = 0; j < VMU_DIR_ENTRIES_PER_BLOCK; j++) { -> + if (bufhead->b_data[j * VMU_DIR_RECORD_LEN] = 0) +> + if (bufhead->b_data[j * VMU_DIR_RECORD_LEN] == 0) > + goto fail; Two words: local variables. Like something that would store bufhead->b_data + j * VMU_DIR_RECORD_LEN instead of copying that expression @@ -53,7 +53,7 @@ it, then compared the copy with ->d_name.name contents and never used that copy again. Why bother copying at all, when comparison with the original would obviously work just as well? -> + dent->d_name.len) = 0) { +> + dent->d_name.len) == 0) { > + ino = vmufat_get_inode(sb, > + le16_to_cpu(((u16 *) bufhead->b_data) > + [j * VMU_DIR_RECORD_LEN16 @@ -115,13 +115,13 @@ l-k != IOCCC. This is way too convoluted for its own good - what you are trying to do is __le16 *p = bh_fat->b_data; for (i = VMUFAT_START_ALLOC; i >= 0; i--) { - if (p[i] = cpu_to_le16(VMUFAT_UNALLOCATED)) { + if (p[i] == cpu_to_le16(VMUFAT_UNALLOCATED)) { put_bh(bh_fat); return i + <whatever>; } } for (i = 0xff; i > VMUFAT_START_ALLOC; i--) { - if (p[i] = cpu_to_le16(VMUFAT_UNALLOCATED)) { + if (p[i] == cpu_to_le16(VMUFAT_UNALLOCATED)) { put_bh(bh_fat); return i + <whatever>; } @@ -156,7 +156,8 @@ Umm... So one can trigger KERN_WARNING printk by normal syscalls? > +{ > + /* offset and header offset settings */ > + if (ino != VMUFAT_ZEROBLOCK) { -> + ((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] > + cpu_to_le16(ino); +> + ((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] = +> + cpu_to_le16(ino); > + ((u16 *) bh->b_data)[recno + VMUFAT_HEADER_OFFSET16] = 0; > + } else { > + ((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] = 0; diff --git a/a/content_digest b/N1/content_digest index da0d3c1..2a8e74e 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -47,7 +47,7 @@ "> +\t\t\tgoto out;\n" "> +\t\t}\n" "> +\t\tfor (j = 0; j < VMU_DIR_ENTRIES_PER_BLOCK; j++) {\n" - "> +\t\t\tif (bufhead->b_data[j * VMU_DIR_RECORD_LEN] = 0)\n" + "> +\t\t\tif (bufhead->b_data[j * VMU_DIR_RECORD_LEN] == 0)\n" "> +\t\t\t\tgoto fail;\n" "Two words: local variables. Like something that would store\n" "bufhead->b_data + j * VMU_DIR_RECORD_LEN instead of copying that expression\n" @@ -64,7 +64,7 @@ "copy again. Why bother copying at all, when comparison with the original\n" "would obviously work just as well?\n" "\n" - "> +\t\t\t\tdent->d_name.len) = 0) {\n" + "> +\t\t\t\tdent->d_name.len) == 0) {\n" "> +\t\t\t\tino = vmufat_get_inode(sb,\n" "> +\t\t\t\t\tle16_to_cpu(((u16 *) bufhead->b_data)\n" "> +\t\t\t\t\t[j * VMU_DIR_RECORD_LEN16\n" @@ -126,13 +126,13 @@ "are trying to do is\n" "\t__le16 *p = bh_fat->b_data;\n" "\tfor (i = VMUFAT_START_ALLOC; i >= 0; i--) {\n" - "\t\tif (p[i] = cpu_to_le16(VMUFAT_UNALLOCATED)) {\n" + "\t\tif (p[i] == cpu_to_le16(VMUFAT_UNALLOCATED)) {\n" "\t\t\tput_bh(bh_fat);\n" "\t\t\treturn i + <whatever>;\n" "\t\t}\n" "\t}\n" "\tfor (i = 0xff; i > VMUFAT_START_ALLOC; i--) {\n" - "\t\tif (p[i] = cpu_to_le16(VMUFAT_UNALLOCATED)) {\n" + "\t\tif (p[i] == cpu_to_le16(VMUFAT_UNALLOCATED)) {\n" "\t\t\tput_bh(bh_fat);\n" "\t\t\treturn i + <whatever>;\n" "\t\t}\n" @@ -167,7 +167,8 @@ "> +{\n" "> +\t/* offset and header offset settings */\n" "> +\tif (ino != VMUFAT_ZEROBLOCK) {\n" - "> +\t\t((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] > +\t\t cpu_to_le16(ino);\n" + "> +\t\t((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] =\n" + "> +\t\t cpu_to_le16(ino);\n" "> +\t\t((u16 *) bh->b_data)[recno + VMUFAT_HEADER_OFFSET16] = 0;\n" "> +\t} else {\n" "> +\t\t((u16 *) bh->b_data)[recno + VMUFAT_START_OFFSET16] = 0;\n" @@ -201,4 +202,4 @@ "\n" So lseek() past the end of directory => -EIO on readdir()? -89ef9bf6644fa824f0698cfdeaa0074bead8849bd57938b923a452302725ee31 +bd840a7b594e1c69d3110d6659baed1aa3b669cbd93de83919866dee6356bfe2
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.