mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
address hfs on-disk corruption robustness review comments
Address Roman's review comments for the previously sent on-disk corruption hfs robustness patch. - use 0 as a failure value, rather than making a new macro HFS_BAD_KEYLEN, and use a switch statement instead of if's. - Add new fail: target to __hfs_brec_find to skip assignments using bad values when exiting with a failure. [akpm@linux-foundation.org: coding-style fixes] Signed-off-by: Eric Sandeen <sandeen@redhat.com> Cc: Roman Zippel <zippel@linux-m68k.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
7c28cbaed6
commit
55581d018e
@@ -52,9 +52,9 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
|
||||
rec = (e + b) / 2;
|
||||
len = hfs_brec_lenoff(bnode, rec, &off);
|
||||
keylen = hfs_brec_keylen(bnode, rec);
|
||||
if (keylen == HFS_BAD_KEYLEN) {
|
||||
if (keylen == 0) {
|
||||
res = -EINVAL;
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
hfs_bnode_read(bnode, fd->key, off, keylen);
|
||||
cmpval = bnode->tree->keycmp(fd->key, fd->search_key);
|
||||
@@ -71,9 +71,9 @@ int __hfs_brec_find(struct hfs_bnode *bnode, struct hfs_find_data *fd)
|
||||
if (rec != e && e >= 0) {
|
||||
len = hfs_brec_lenoff(bnode, e, &off);
|
||||
keylen = hfs_brec_keylen(bnode, e);
|
||||
if (keylen == HFS_BAD_KEYLEN) {
|
||||
if (keylen == 0) {
|
||||
res = -EINVAL;
|
||||
goto done;
|
||||
goto fail;
|
||||
}
|
||||
hfs_bnode_read(bnode, fd->key, off, keylen);
|
||||
}
|
||||
@@ -83,6 +83,7 @@ done:
|
||||
fd->keylength = keylen;
|
||||
fd->entryoffset = off + keylen;
|
||||
fd->entrylength = len - keylen;
|
||||
fail:
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -206,7 +207,7 @@ int hfs_brec_goto(struct hfs_find_data *fd, int cnt)
|
||||
|
||||
len = hfs_brec_lenoff(bnode, fd->record, &off);
|
||||
keylen = hfs_brec_keylen(bnode, fd->record);
|
||||
if (keylen == HFS_BAD_KEYLEN) {
|
||||
if (keylen == 0) {
|
||||
res = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user