Linux Headquarters
[ Register ]
[ About us ] [ Home Page ]

[ Kernel ] [ Documentation ] [ Links ] [ Books ]

Advertisement

Kernel v2.6.24 /fs/hfs/bfind.c

Filename:/fs/hfs/bfind.c
Lines Added:12
Lines Deleted:0
Also changed in: (Previous) 2.6.24-rc8  2.6.24-rc7-git8  2.6.24-rc7-git7  2.6.24-rc7-git6  2.6.24-rc7-git5  2.6.24-rc7-git4 
(Following) 2.6.24-git16  2.6.24-git17  2.6.24-git18  2.6.24-git19  2.6.24-git20  2.6.24-git21 

Location
[  2.6.24
  [  fs
    [  hfs
       o  bfind.c

Patch

diff --git a/fs/hfs/bfind.c b/fs/hfs/bfind.c
index f13f149..f8452a0 100644
--- a/fs/hfs/bfind.c
+++ b/fs/hfs/bfind.c
@@ -52,6 +52,10 @@ 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) {
+         res = -EINVAL;
+         goto done;
+      }
       hfs_bnode_read(bnode, fd->key, off, keylen);
       cmpval = bnode->tree->keycmp(fd->key, fd->search_key);
       if (!cmpval) {
@@ -67,6 +71,10 @@ 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) {
+         res = -EINVAL;
+         goto done;
+      }
       hfs_bnode_read(bnode, fd->key, off, keylen);
    }
 done:
@@ -198,6 +206,10 @@ 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) {
+      res = -EINVAL;
+      goto out;
+   }
    fd->keyoffset = off;
    fd->keylength = keylen;
    fd->entryoffset = off + keylen;


Comments: webmaster (at) linuxhq.com.
Advertising: banners (at) linuxhq.com.
Compilation ©1998-2008 Linux Headquarters, Inc.