From: Jeff Mahoney <jeffm@suse.com>
To: ReiserFS List <reiserfs-list@namesys.com>
Subject: Re: [PATCH] reiserfsprogs: id_map_init off-by-one
Date: Thu, 20 Apr 2006 15:14:32 -0400 [thread overview]
Message-ID: <4447DD98.8060505@suse.com> (raw)
In-Reply-To: <20060420191040.GA7261@locomotive.unixthugs.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jeff Mahoney wrote:
> The following patch fixes a bug where reiserfsck will crash if OIDs up around
> the maximum are in use. The problem is that INDEX_COUNT ends up rounding down
> and the last chunk isn't allocated, causing a segfault.
>
> --- reiserfsprogs-3.6.19/fsck/uobjectid.c 2004-06-17 15:57:39.000000000 -0400
> +++ reiserfsprogs-3.6.19.devel/fsck/uobjectid.c 2006-04-20 15:05:45.000000000 -0400
> @@ -33,7 +33,7 @@ id_map_t *id_map_init() {
> __u32 i;
>
> map = getmem(sizeof(id_map_t));
> - map->index = mem_alloc(INDEX_COUNT * sizeof(void *));
> + map->index = mem_alloc((INDEX_COUNT + 1) * sizeof(void *));
>
> for (i = 0; i < INDEX_COUNT; i++) {
> if (map->index[i] != (void *)0)
Of course, this fix is wrong. It eliminates the bug, since the memory is
allocated, but it's not properly initialized.
- -Jeff
- --
Jeff Mahoney
SUSE Labs
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFER92YLPWxlyuTD7IRAkuqAKCaETt3ur8/n2qK1GCKq1FtfJiT0QCfeMRx
NgMpCoJ3Zhj8mvYMqDpDoHI=
=GxSn
-----END PGP SIGNATURE-----
next prev parent reply other threads:[~2006-04-20 19:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-20 19:10 [PATCH] reiserfsprogs: id_map_init off-by-one Jeff Mahoney
2006-04-20 19:14 ` Jeff Mahoney [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-04-20 19:20 Jeff Mahoney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4447DD98.8060505@suse.com \
--to=jeffm@suse.com \
--cc=reiserfs-list@namesys.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.