mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Daniel Aragonés" <danarag@gmail.com>
Cc: penberg@cs.helsinki.fi, linux-kernel@vger.kernel.org
Subject: Re: [PATCH/RFC] minix filesystem update to V3 for 2.6 kernels
Date: Sun, 30 Apr 2006 13:45:27 -0700	[thread overview]
Message-ID: <20060430134527.5175661a.akpm@osdl.org> (raw)
In-Reply-To: <4454C131.8070309@gmail.com>

Daniel Aragonés <danarag@gmail.com> wrote:
>
> Hi Andrew,
> 
> As a continuation of my former communication of January 25, and after having posted the attached patch in my personal page http://www.terra.es/personal2/danarag for about 3 months, feedback has come 
> to me, and some bugs have been detected and corrected.

People use minixfs?  I'm a bit surprised.

> I believe that now (not before) the patch is really ready for merging into the main line if you consider it appropriate.

We'd need a detailed changelog please.

> Signed-off-by: Daniel Aragones <danarag@gmail.com>

The patch gets lots of rejects.  More than I'm prepared to fix up so I can
take a look at it in tkdiff, unfortunately.

I suspect the patch was against some prehistoric kernel like 2.6.16 ;)


> @@ -79,24 +96,35 @@
>  int minix_new_block(struct inode * inode)
>  {
>  	struct minix_sb_info *sbi = minix_sb(inode->i_sb);
> -	int i;
> +	char *offset = kmalloc(sizeof(char *), GFP_KERNEL);

That's a peculiar thing to do.

> +	int num_1K_blocks = (inode->i_sb->s_blocksize)/1024;
> +	int bits_per_zone = 8 * (inode->i_sb->s_blocksize);
> +	int i, k;
>  
>  	for (i = 0; i < sbi->s_zmap_blocks; i++) {
>  		struct buffer_head *bh = sbi->s_zmap[i];
> -		int j;
> +		for (k = 0; k < num_1K_blocks; k++) {
> +			int j;
>  
> -		lock_kernel();
> -		if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192) {
> -			minix_set_bit(j,bh->b_data);
> -			unlock_kernel();
> -			mark_buffer_dirty(bh);
> -			j += i*8192 + sbi->s_firstdatazone-1;
> -			if (j < sbi->s_firstdatazone || j >= sbi->s_nzones)
> -				break;
> -			return j;
> +			offset = (char *)bh->b_data;

And here I think we've just leaked that memory.

> +	bit = ino & 8191;
> +	ino >>= 13;
> +	mask >>= (4-k);
> +	if ((ino >> k) >= sbi->s_imap_blocks) {
>  		printk("minix_free_inode: nonexistent imap in superblock\n");
>  		goto out;
>  	}
>  
>  	minix_clear_inode(inode);	/* clear on-disk copy */
>  
> -	bh = sbi->s_imap[ino >> 13];
> +	char *offset = kmalloc(sizeof(char *), GFP_KERNEL);
> +	bh = sbi->s_imap[ino >> k];
> +	offset = (char *)bh->b_data;

And again.  Here we've definitely leaked it.

> @@ -226,26 +268,36 @@
>  	j = 8192;
>  	bh = NULL;
>  	*error = -ENOSPC;
> +	char *offset = kmalloc(sizeof(char *), GFP_KERNEL);
>  	lock_kernel();
>  	for (i = 0; i < sbi->s_imap_blocks; i++) {
>  		bh = sbi->s_imap[i];
> -		if ((j = minix_find_first_zero_bit(bh->b_data, 8192)) < 8192)
> -			break;
> +		for (k = 0; k < num_1K_blocks; k++) {
> +			offset = (char *)bh->b_data;

again



  reply	other threads:[~2006-04-30 20:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-30 13:52 Daniel Aragonés
2006-04-30 20:45 ` Andrew Morton [this message]
2006-05-01  6:38   ` Arjan van de Ven
2006-05-01 13:57   ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2006-01-25 16:59 Daniel Aragonés

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=20060430134527.5175661a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=danarag@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome