public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] UDF: possible usage of uninitialized variables
@ 2007-05-22 17:52 Cyrill Gorcunov
  2007-05-22 18:39 ` Andrew Morton
  2007-05-22 20:29 ` Jan Kara
  0 siblings, 2 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2007-05-22 17:52 UTC (permalink / raw)
  To: LKML

A few variables could be used without being explicitly initialized.
Fixed.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---


 balloc.c |    6 +++++-
 super.c  |    5 ++++-
 2 files changed, 9 insertions(+), 2 deletions(-)


diff --git a/balloc.c b/balloc.c
index 4cec910..be37393 100644
--- a/balloc.c
+++ b/balloc.c
@@ -744,7 +744,11 @@ static int udf_table_new_block(struct super_block * sb,
 	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
 	uint32_t newblock = 0, adsize;
 	uint32_t elen, goal_elen = 0;
-	kernel_lb_addr eloc, goal_eloc;
+	kernel_lb_addr eloc;
+	kernel_lb_addr goal_eloc = {
+		.logicalBlockNum = 0,
+		.partitionReferenceNum = 0,
+	};
 	struct extent_position epos, goal_epos;
 	int8_t etype;
 
diff --git a/super.c b/super.c
index 9b8644a..068a99c 100644
--- a/super.c
+++ b/super.c
@@ -1358,7 +1358,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
 			case UDF_VIRTUAL_MAP15:
 			case UDF_VIRTUAL_MAP20:
 			{
-				kernel_lb_addr ino;
+				kernel_lb_addr ino = {
+					.logicalBlockNum = 0,
+					.partitionReferenceNum = 0,
+				};
 
 				if (!UDF_SB_LASTBLOCK(sb))
 				{

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

* Re: [PATCH] UDF: possible usage of uninitialized variables
  2007-05-22 17:52 [PATCH] UDF: possible usage of uninitialized variables Cyrill Gorcunov
@ 2007-05-22 18:39 ` Andrew Morton
  2007-05-22 20:29 ` Jan Kara
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Morton @ 2007-05-22 18:39 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: LKML

On Tue, 22 May 2007 21:52:23 +0400
Cyrill Gorcunov <gorcunov@gmail.com> wrote:

> A few variables could be used without being explicitly initialized.
> Fixed.

Are you sure?  I'm expecting that this is a gcc mistake.

> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> 
> 
>  balloc.c |    6 +++++-
>  super.c  |    5 ++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/balloc.c b/balloc.c
> index 4cec910..be37393 100644
> --- a/balloc.c
> +++ b/balloc.c

Please always use `patch -p1' form from the top-level directory.  This should
have been

--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c

> @@ -744,7 +744,11 @@ static int udf_table_new_block(struct super_block * sb,
>  	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
>  	uint32_t newblock = 0, adsize;
>  	uint32_t elen, goal_elen = 0;
> -	kernel_lb_addr eloc, goal_eloc;
> +	kernel_lb_addr eloc;
> +	kernel_lb_addr goal_eloc = {
> +		.logicalBlockNum = 0,
> +		.partitionReferenceNum = 0,
> +	};

	kernel_lb_addr goal_eloc = { };

is equivalent and sufficient.

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

* Re: [PATCH] UDF: possible usage of uninitialized variables
  2007-05-22 17:52 [PATCH] UDF: possible usage of uninitialized variables Cyrill Gorcunov
  2007-05-22 18:39 ` Andrew Morton
@ 2007-05-22 20:29 ` Jan Kara
  2007-05-23 14:17   ` Cyrill Gorcunov
  2007-05-23 16:05   ` Cyrill Gorcunov
  1 sibling, 2 replies; 5+ messages in thread
From: Jan Kara @ 2007-05-22 20:29 UTC (permalink / raw)
  To: Cyrill Gorcunov; +Cc: LKML

> A few variables could be used without being explicitly initialized.
> Fixed.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
> ---
> 
> 
>  balloc.c |    6 +++++-
>  super.c  |    5 ++++-
>  2 files changed, 9 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/balloc.c b/balloc.c
> index 4cec910..be37393 100644
> --- a/balloc.c
> +++ b/balloc.c
> @@ -744,7 +744,11 @@ static int udf_table_new_block(struct super_block * sb,
>  	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
>  	uint32_t newblock = 0, adsize;
>  	uint32_t elen, goal_elen = 0;
> -	kernel_lb_addr eloc, goal_eloc;
> +	kernel_lb_addr eloc;
> +	kernel_lb_addr goal_eloc = {
> +		.logicalBlockNum = 0,
> +		.partitionReferenceNum = 0,
> +	};
>  	struct extent_position epos, goal_epos;
>  	int8_t etype;
  As I read the code, I don't think it can happen goal_eloc is used
unitialized. Also please diff the tree completely, not just the udf
directory..

> diff --git a/super.c b/super.c
> index 9b8644a..068a99c 100644
> --- a/super.c
> +++ b/super.c
> @@ -1358,7 +1358,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
>  			case UDF_VIRTUAL_MAP15:
>  			case UDF_VIRTUAL_MAP20:
>  			{
> -				kernel_lb_addr ino;
> +				kernel_lb_addr ino = {
> +					.logicalBlockNum = 0,
> +					.partitionReferenceNum = 0,
> +				};
>  
>  				if (!UDF_SB_LASTBLOCK(sb))
>  				{
  This one seems correct. Thanks for fixing this.

								Honza
-- 
Jan Kara <jack@suse.cz>
SuSE CR Labs

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

* Re: [PATCH] UDF: possible usage of uninitialized variables
  2007-05-22 20:29 ` Jan Kara
@ 2007-05-23 14:17   ` Cyrill Gorcunov
  2007-05-23 16:05   ` Cyrill Gorcunov
  1 sibling, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2007-05-23 14:17 UTC (permalink / raw)
  To: Jan Kara; +Cc: Cyrill Gorcunov, LKML, Andrew Morton

[Jan Kara - Tue, May 22, 2007 at 10:29:38PM +0200]
| > A few variables could be used without being explicitly initialized.
| > Fixed.
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > ---
| > 
| > 
| >  balloc.c |    6 +++++-
| >  super.c  |    5 ++++-
| >  2 files changed, 9 insertions(+), 2 deletions(-)
| > 
| > 
| > diff --git a/balloc.c b/balloc.c
| > index 4cec910..be37393 100644
| > --- a/balloc.c
| > +++ b/balloc.c
| > @@ -744,7 +744,11 @@ static int udf_table_new_block(struct super_block * sb,
| >  	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
| >  	uint32_t newblock = 0, adsize;
| >  	uint32_t elen, goal_elen = 0;
| > -	kernel_lb_addr eloc, goal_eloc;
| > +	kernel_lb_addr eloc;
| > +	kernel_lb_addr goal_eloc = {
| > +		.logicalBlockNum = 0,
| > +		.partitionReferenceNum = 0,
| > +	};
| >  	struct extent_position epos, goal_epos;
| >  	int8_t etype;
|   As I read the code, I don't think it can happen goal_eloc is used
| unitialized. Also please diff the tree completely, not just the udf
| directory..
| 
| > diff --git a/super.c b/super.c
| > index 9b8644a..068a99c 100644
| > --- a/super.c
| > +++ b/super.c
| > @@ -1358,7 +1358,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
| >  			case UDF_VIRTUAL_MAP15:
| >  			case UDF_VIRTUAL_MAP20:
| >  			{
| > -				kernel_lb_addr ino;
| > +				kernel_lb_addr ino = {
| > +					.logicalBlockNum = 0,
| > +					.partitionReferenceNum = 0,
| > +				};
| >  
| >  				if (!UDF_SB_LASTBLOCK(sb))
| >  				{
|   This one seems correct. Thanks for fixing this.
| 
| 								Honza
| -- 
| Jan Kara <jack@suse.cz>
| SuSE CR Labs
| 

Sorry, that's my fault :(

		Cyrill


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

* Re: [PATCH] UDF: possible usage of uninitialized variables
  2007-05-22 20:29 ` Jan Kara
  2007-05-23 14:17   ` Cyrill Gorcunov
@ 2007-05-23 16:05   ` Cyrill Gorcunov
  1 sibling, 0 replies; 5+ messages in thread
From: Cyrill Gorcunov @ 2007-05-23 16:05 UTC (permalink / raw)
  To: Jan Kara; +Cc: Andrew Morton, LKML

[Jan Kara - Tue, May 22, 2007 at 10:29:38PM +0200]
| > A few variables could be used without being explicitly initialized.
| > Fixed.
| > 
| > Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| > ---
| > 
| > 
| >  balloc.c |    6 +++++-
| >  super.c  |    5 ++++-
| >  2 files changed, 9 insertions(+), 2 deletions(-)
| > 
| > 
| > diff --git a/balloc.c b/balloc.c
| > index 4cec910..be37393 100644
| > --- a/balloc.c
| > +++ b/balloc.c
| > @@ -744,7 +744,11 @@ static int udf_table_new_block(struct super_block * sb,
| >  	uint32_t spread = 0xFFFFFFFF, nspread = 0xFFFFFFFF;
| >  	uint32_t newblock = 0, adsize;
| >  	uint32_t elen, goal_elen = 0;
| > -	kernel_lb_addr eloc, goal_eloc;
| > +	kernel_lb_addr eloc;
| > +	kernel_lb_addr goal_eloc = {
| > +		.logicalBlockNum = 0,
| > +		.partitionReferenceNum = 0,
| > +	};
| >  	struct extent_position epos, goal_epos;
| >  	int8_t etype;
|   As I read the code, I don't think it can happen goal_eloc is used
| unitialized. Also please diff the tree completely, not just the udf
| directory..
| 
| > diff --git a/super.c b/super.c
| > index 9b8644a..068a99c 100644
| > --- a/super.c
| > +++ b/super.c
| > @@ -1358,7 +1358,10 @@ udf_load_partition(struct super_block *sb, kernel_lb_addr *fileset)
| >  			case UDF_VIRTUAL_MAP15:
| >  			case UDF_VIRTUAL_MAP20:
| >  			{
| > -				kernel_lb_addr ino;
| > +				kernel_lb_addr ino = {
| > +					.logicalBlockNum = 0,
| > +					.partitionReferenceNum = 0,
| > +				};
| >  
| >  				if (!UDF_SB_LASTBLOCK(sb))
| >  				{
|   This one seems correct. Thanks for fixing this.
| 
| 								Honza
| -- 
| Jan Kara <jack@suse.cz>
| SuSE CR Labs
| 

Jan, you know I've been messed up. The variables I've touched in my patch
became initialized in any case.

Andrew, just drop my patch (you're right and I was wrong ;).

Thanks you both for comments.

		Cyrill


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

end of thread, other threads:[~2007-05-23 16:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-22 17:52 [PATCH] UDF: possible usage of uninitialized variables Cyrill Gorcunov
2007-05-22 18:39 ` Andrew Morton
2007-05-22 20:29 ` Jan Kara
2007-05-23 14:17   ` Cyrill Gorcunov
2007-05-23 16:05   ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox