From: Christoph Hellwig <hch@lst.de>
To: akpm@osdl.org, zkambarov@coverity.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix Coverity braindamage in UDF
Date: Wed, 29 Jun 2005 09:03:09 +0200 [thread overview]
Message-ID: <20050629070309.GA18901@lst.de> (raw)
Andrew, please don't blindly apply Coverity patches. While the checker
is smart at finding inconsistencies, that "obvious" fix is wrong most of
the item. As in this unreviewed UDF patch that got in:
udf_find_entry can never be called with a NULL argument, so we shouldn't
check for it instead of adding more assignments behind the check.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Index: linux-2.6/fs/udf/namei.c
===================================================================
--- linux-2.6.orig/fs/udf/namei.c 2005-06-29 08:56:02.000000000 +0200
+++ linux-2.6/fs/udf/namei.c 2005-06-29 08:59:25.000000000 +0200
@@ -153,24 +153,17 @@
struct fileIdentDesc *cfi)
{
struct fileIdentDesc *fi=NULL;
- loff_t f_pos;
+ loff_t f_pos = (udf_ext0_offset(dir) >> 2);
int block, flen;
char fname[UDF_NAME_LEN];
char *nameptr;
uint8_t lfi;
uint16_t liu;
- loff_t size;
+ loff_t size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
kernel_lb_addr bloc, eloc;
uint32_t extoffset, elen, offset;
struct buffer_head *bh = NULL;
- if (!dir)
- return NULL;
-
- size = (udf_ext0_offset(dir) + dir->i_size) >> 2;
-
- f_pos = (udf_ext0_offset(dir) >> 2);
-
fibh->soffset = fibh->eoffset = (f_pos & ((dir->i_sb->s_blocksize - 1) >> 2)) << 2;
if (UDF_I_ALLOCTYPE(dir) == ICBTAG_FLAG_AD_IN_ICB)
fibh->sbh = fibh->ebh = NULL;
next reply other threads:[~2005-06-29 7:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-29 7:03 Christoph Hellwig [this message]
2005-06-29 7:13 ` [PATCH] fix Coverity braindamage in UDF 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=20050629070309.GA18901@lst.de \
--to=hch@lst.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zkambarov@coverity.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.