Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1442286 > unrolled thread

[patch] Squashfs: silence some uninitialized variable warnings

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-07-13 12:10 +0200
Last post2016-07-13 13:40 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] Squashfs: silence some uninitialized variable warnings Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-13 12:10 +0200
    Re: [patch] Squashfs: silence some uninitialized variable warnings Dan Carpenter <dan.carpenter@oracle.com> - 2016-07-13 13:40 +0200
    Re: [patch] Squashfs: silence some uninitialized variable warnings Silvan Jegen <s.jegen@gmail.com> - 2016-07-13 13:40 +0200

#1442286 — [patch] Squashfs: silence some uninitialized variable warnings

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-07-13 12:10 +0200
Subject[patch] Squashfs: silence some uninitialized variable warnings
Message-ID<rUph7-1FZ-7@gated-at.bofh.it>
We print these values in the TRACE() code before we check that
fill_meta_index() was successful.  It makes my static checker complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index 13d8094..46679e2 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -334,9 +334,9 @@ failed:
  */
 static int read_blocklist(struct inode *inode, int index, u64 *block)
 {
-	u64 start;
+	u64 start = -1;
 	long long blks;
-	int offset;
+	int offset = -1;
 	__le32 size;
 	int res = fill_meta_index(inode, index, &start, &offset, block);
 

[toc] | [next] | [standalone]


#1442359

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-07-13 13:40 +0200
Message-ID<rUqGd-2sM-21@gated-at.bofh.it>
In reply to#1442286
On Wed, Jul 13, 2016 at 01:29:32PM +0200, Silvan Jegen wrote:
> Hi Dan
> 
> On Wed, Jul 13, 2016 at 12:02 PM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > We print these values in the TRACE() code before we check that
> > fill_meta_index() was successful.  It makes my static checker complain.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
> > diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
> > index 13d8094..46679e2 100644
> > --- a/fs/squashfs/file.c
> > +++ b/fs/squashfs/file.c
> > @@ -334,9 +334,9 @@ failed:
> >   */
> >  static int read_blocklist(struct inode *inode, int index, u64 *block)
> >  {
> > -       u64 start;
> > +       u64 start = -1;
> 
> Do you assign the negative value to the unsigned variable here on purpose?
> 

Yeah.  It's just a garbage value but hopefully it would stand out in the
printk.

regards,
dan carpenter

[toc] | [prev] | [next] | [standalone]


#1442361

FromSilvan Jegen <s.jegen@gmail.com>
Date2016-07-13 13:40 +0200
Message-ID<rUqGd-2sM-23@gated-at.bofh.it>
In reply to#1442286
Hi Dan

On Wed, Jul 13, 2016 at 12:02 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> We print these values in the TRACE() code before we check that
> fill_meta_index() was successful.  It makes my static checker complain.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
> index 13d8094..46679e2 100644
> --- a/fs/squashfs/file.c
> +++ b/fs/squashfs/file.c
> @@ -334,9 +334,9 @@ failed:
>   */
>  static int read_blocklist(struct inode *inode, int index, u64 *block)
>  {
> -       u64 start;
> +       u64 start = -1;

Do you assign the negative value to the unsigned variable here on purpose?


Cheers,

Silvan

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web