kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] exofs: fix endian conversion in exofs_sync_fs()
@ 2011-11-21 14:43 Dan Carpenter
  2011-11-22  0:57 ` Boaz Harrosh
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dan Carpenter @ 2011-11-21 14:43 UTC (permalink / raw)
  To: kernel-janitors

fscb->s_numfiles is an __le64 field so we need to use cpu_to_le64()
to get a little endian 64 bit on big endian systems.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This is a static checker fix.  Untested.

diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index e6085ec..53b55a3 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -390,7 +390,7 @@ static int exofs_sync_fs(struct super_block *sb, int wait)
 	ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
 	memset(fscb, 0, ios->length);
 	fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
-	fscb->s_numfiles = cpu_to_le32(sbi->s_numfiles);
+	fscb->s_numfiles = cpu_to_le64(sbi->s_numfiles);
 	fscb->s_magic = cpu_to_le16(sb->s_magic);
 	fscb->s_newfs = 0;
 	fscb->s_version = EXOFS_FSCB_VER;

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

* Re: [patch] exofs: fix endian conversion in exofs_sync_fs()
  2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
@ 2011-11-22  0:57 ` Boaz Harrosh
  2012-01-29 14:25 ` Dan Carpenter
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Boaz Harrosh @ 2011-11-22  0:57 UTC (permalink / raw)
  To: kernel-janitors

On 11/21/2011 06:43 AM, Dan Carpenter wrote:
> fscb->s_numfiles is an __le64 field so we need to use cpu_to_le64()
> to get a little endian 64 bit on big endian systems.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> This is a static checker fix.  Untested.
> 

Will apply. s_numfiles is never used but should be loaded
correctly regardless.

Thanks
Boaz

> diff --git a/fs/exofs/super.c b/fs/exofs/super.c
> index e6085ec..53b55a3 100644
> --- a/fs/exofs/super.c
> +++ b/fs/exofs/super.c
> @@ -390,7 +390,7 @@ static int exofs_sync_fs(struct super_block *sb, int wait)
>  	ios->length = offsetof(struct exofs_fscb, s_dev_table_oid);
>  	memset(fscb, 0, ios->length);
>  	fscb->s_nextid = cpu_to_le64(sbi->s_nextid);
> -	fscb->s_numfiles = cpu_to_le32(sbi->s_numfiles);
> +	fscb->s_numfiles = cpu_to_le64(sbi->s_numfiles);
>  	fscb->s_magic = cpu_to_le16(sb->s_magic);
>  	fscb->s_newfs = 0;
>  	fscb->s_version = EXOFS_FSCB_VER;


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

* Re: [patch] exofs: fix endian conversion in exofs_sync_fs()
  2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
  2011-11-22  0:57 ` Boaz Harrosh
@ 2012-01-29 14:25 ` Dan Carpenter
  2012-01-29 14:29 ` Dan Carpenter
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-01-29 14:25 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 532 bytes --]

On Mon, Nov 21, 2011 at 04:57:23PM -0800, Boaz Harrosh wrote:
> On 11/21/2011 06:43 AM, Dan Carpenter wrote:
> > fscb->s_numfiles is an __le64 field so we need to use cpu_to_le64()
> > to get a little endian 64 bit on big endian systems.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > This is a static checker fix.  Untested.
> > 
> 
> Will apply. s_numfiles is never used but should be loaded
> correctly regardless.
> 

This is still the same in linux-next.

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] exofs: fix endian conversion in exofs_sync_fs()
  2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
  2011-11-22  0:57 ` Boaz Harrosh
  2012-01-29 14:25 ` Dan Carpenter
@ 2012-01-29 14:29 ` Dan Carpenter
  2012-01-30 13:45 ` Boaz Harrosh
  2012-01-30 13:58 ` Dan Carpenter
  4 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-01-29 14:29 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

On Sun, Jan 29, 2012 at 05:25:33PM +0300, Dan Carpenter wrote:
> On Mon, Nov 21, 2011 at 04:57:23PM -0800, Boaz Harrosh wrote:
> > On 11/21/2011 06:43 AM, Dan Carpenter wrote:
> > > fscb->s_numfiles is an __le64 field so we need to use cpu_to_le64()
> > > to get a little endian 64 bit on big endian systems.
> > > 
> > > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > > ---
> > > This is a static checker fix.  Untested.
> > > 
> > 
> > Will apply. s_numfiles is never used but should be loaded
> > correctly regardless.
> > 
> 
> This is still the same in linux-next.

Also Sparse warns about the following potential stack overflows.
The kernel has an 8k stack and the upper limit on these array sizes
are not capped.

fs/exofs/super.c:562:51: error: bad constant expression
fs/exofs/super.c:563:38: error: bad constant expression

regards,
dan carpenter

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [patch] exofs: fix endian conversion in exofs_sync_fs()
  2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
                   ` (2 preceding siblings ...)
  2012-01-29 14:29 ` Dan Carpenter
@ 2012-01-30 13:45 ` Boaz Harrosh
  2012-01-30 13:58 ` Dan Carpenter
  4 siblings, 0 replies; 6+ messages in thread
From: Boaz Harrosh @ 2012-01-30 13:45 UTC (permalink / raw)
  To: kernel-janitors

On 01/29/2012 04:29 PM, Dan Carpenter wrote:
> On Sun, Jan 29, 2012 at 05:25:33PM +0300, Dan Carpenter wrote:
>> On Mon, Nov 21, 2011 at 04:57:23PM -0800, Boaz Harrosh wrote:
>>> On 11/21/2011 06:43 AM, Dan Carpenter wrote:
>>>> fscb->s_numfiles is an __le64 field so we need to use cpu_to_le64()
>>>> to get a little endian 64 bit on big endian systems.
>>>>
>>>> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>> ---
>>>> This is a static checker fix.  Untested.
>>>>
>>>
>>> Will apply. s_numfiles is never used but should be loaded
>>> correctly regardless.
>>>
>>
>> This is still the same in linux-next.
> 

Sorry will fix.

> Also Sparse warns about the following potential stack overflows.
> The kernel has an 8k stack and the upper limit on these array sizes
> are not capped.
> 
> fs/exofs/super.c:562:51: error: bad constant expression
> fs/exofs/super.c:563:38: error: bad constant expression
> 

Do you mean this code:
	struct __alloc_ore_devs_and_exofs_devs {
		/* Twice bigger table: See exofs_init_comps() and comment at
		 * exofs_read_lookup_dev_table()
		 */
=>		struct ore_dev *oreds[numdevs * 2 - 1];
=>		struct exofs_dev eds[numdevs];
	} *aoded;


If so than Sparse should be fixed. It is plain wrong. This complete
structure is kmalloc(ed) two lines below.

The only limit is, perhaps, the entire struct should not be bigger than
PAGE_SIZE but kmalloc would fail and we will not mount. That code is
fine

> regards,
> dan carpenter

Cheers
Boaz

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

* Re: [patch] exofs: fix endian conversion in exofs_sync_fs()
  2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
                   ` (3 preceding siblings ...)
  2012-01-30 13:45 ` Boaz Harrosh
@ 2012-01-30 13:58 ` Dan Carpenter
  4 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-01-30 13:58 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Mon, Jan 30, 2012 at 03:45:07PM +0200, Boaz Harrosh wrote:
> Do you mean this code:
> 	struct __alloc_ore_devs_and_exofs_devs {
> 		/* Twice bigger table: See exofs_init_comps() and comment at
> 		 * exofs_read_lookup_dev_table()
> 		 */
> =>		struct ore_dev *oreds[numdevs * 2 - 1];
> =>		struct exofs_dev eds[numdevs];
> 	} *aoded;
> 
> 
> If so than Sparse should be fixed. It is plain wrong. This complete
> structure is kmalloc(ed) two lines below.
> 

Oh yeah.  You are right.  I misread how that worked.

regards,
dan carpenter



[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-01-30 13:58 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 14:43 [patch] exofs: fix endian conversion in exofs_sync_fs() Dan Carpenter
2011-11-22  0:57 ` Boaz Harrosh
2012-01-29 14:25 ` Dan Carpenter
2012-01-29 14:29 ` Dan Carpenter
2012-01-30 13:45 ` Boaz Harrosh
2012-01-30 13:58 ` 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).