mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David VomLehn <dvomlehn@cisco.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Propagate CRAMFS uncompression errors
Date: Mon, 09 Feb 2009 20:06:01 -0800	[thread overview]
Message-ID: <1234238761.17414.2.camel@cuplxvomd02.corp.sa.net> (raw)
In-Reply-To: <20090209194825.e052e07a.akpm@linux-foundation.org>


On Mon, 2009-02-09 at 19:48 -0800, Andrew Morton wrote:
...
> 
> umm...
> 
> Nope, it's still not right.  We'll treat this case:
> 
> 		if (compr_len == 0)
> 			; /* hole */
> 
> as an IO error.  grr.
> 
> --- a/fs/cramfs/inode.c~cramfs-propagate-uncompression-errors
> +++ a/fs/cramfs/inode.c
> @@ -477,7 +477,7 @@ static int cramfs_readpage(struct file *
>  		mutex_unlock(&read_mutex);
>  		pgdata = kmap(page);
>  		if (compr_len == 0)
> -			; /* hole */
> +			goto out; /* hole */
>  		else if (compr_len > (PAGE_CACHE_SIZE << 1))
>  			printk(KERN_ERR "cramfs: bad compressed blocksize %u\n", compr_len);
>  		else {
> @@ -488,12 +488,20 @@ static int cramfs_readpage(struct file *
>  				 compr_len);
>  			mutex_unlock(&read_mutex);
>  		}
> -	} else
> -		pgdata = kmap(page);
> -	memset(pgdata + bytes_filled, 0, PAGE_CACHE_SIZE - bytes_filled);
> -	kunmap(page);
> -	flush_dcache_page(page);
> -	SetPageUptodate(page);
> +
> +		if (bytes_filled == 0) {
> +			/* Decompression error */
> +			ClearPageUptodate(page);
> +			SetPageError(page);
> +		} else {
> +			memset(pgdata + bytes_filled, 0,
> +					PAGE_CACHE_SIZE - bytes_filled);
> +			flush_dcache_page(page);
> +			SetPageUptodate(page);
> +		}
> +		kunmap(page);
> +	}
> +out:
>  	unlock_page(page);
>  	return 0;
>  }

Is that actually an error. The comment in the code is, uh, a bit terse,
but I took it to mean that there was a deliberate hole, just like holes
in files that should read as all zeroes. But even if it's actually an
error, we still need to kunmap the page
-- 
David VomLehn, dvomlehn@cisco.com




     - - - - -                              Cisco                            - - - - -         
This e-mail and any attachments may contain information which is confidential, 
proprietary, privileged or otherwise protected by law. The information is solely 
intended for the named addressee (or a person responsible for delivering it to 
the addressee). If you are not the intended recipient of this message, you are 
not authorized to read, print, retain, copy or disseminate this message or any 
part of it. If you have received this e-mail in error, please notify the sender 
immediately by return e-mail and delete it from your computer.


  reply	other threads:[~2009-02-10  4:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-07  2:55 David VomLehn (dvomlehn)
2009-02-09 23:16 ` Andrew Morton
2009-02-10  3:28   ` David VomLehn (dvomlehn)
2009-02-10  3:48     ` Andrew Morton
2009-02-10  4:06       ` David VomLehn [this message]
2009-02-10  5:10         ` Andrew Morton

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=1234238761.17414.2.camel@cuplxvomd02.corp.sa.net \
    --to=dvomlehn@cisco.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®