kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] Squashfs: silence some uninitialized variable warnings
@ 2016-07-13 10:02 Dan Carpenter
  2016-07-13 11:29 ` Silvan Jegen
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2016-07-13 10:02 UTC (permalink / raw)
  To: Phillip Lougher; +Cc: linux-kernel, kernel-janitors

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);
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] Squashfs: silence some uninitialized variable warnings
  2016-07-13 10:02 [patch] Squashfs: silence some uninitialized variable warnings Dan Carpenter
@ 2016-07-13 11:29 ` Silvan Jegen
  2016-07-13 11:36   ` Dan Carpenter
  0 siblings, 1 reply; 3+ messages in thread
From: Silvan Jegen @ 2016-07-13 11:29 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Phillip Lougher, lkml, kernel-janitors

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] Squashfs: silence some uninitialized variable warnings
  2016-07-13 11:29 ` Silvan Jegen
@ 2016-07-13 11:36   ` Dan Carpenter
  0 siblings, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2016-07-13 11:36 UTC (permalink / raw)
  To: Silvan Jegen; +Cc: Phillip Lougher, lkml, kernel-janitors

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-07-13 11:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-13 10:02 [patch] Squashfs: silence some uninitialized variable warnings Dan Carpenter
2016-07-13 11:29 ` Silvan Jegen
2016-07-13 11:36   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).