mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fs: ubifs: remove always-false check
@ 2022-08-11 13:58 Ahmad Fatoum
  2022-08-11 16:29 ` Uwe Kleine-König
  2022-09-13  8:37 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-08-11 13:58 UTC (permalink / raw)
  To: barebox; +Cc: ukl, Ahmad Fatoum

GCC correctly warns that two bit wide compr_type can't
exceed or be equal to UBIFS_COMPR_TYPES_CNT (== 4).

Remove the check. The check is there in the kernel as well,
but the warning is disabled there.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 fs/ubifs/super.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b48e21fae636..6a0074bd1a5c 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -86,11 +86,6 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
 		return 1;
 	}
 
-	if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) {
-		ubifs_err(c, "unknown compression type %d", ui->compr_type);
-		return 2;
-	}
-
 	if (ui->xattr_names + ui->xattr_cnt > XATTR_LIST_MAX)
 		return 3;
 
-- 
2.30.2




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

* Re: [PATCH] fs: ubifs: remove always-false check
  2022-08-11 13:58 [PATCH] fs: ubifs: remove always-false check Ahmad Fatoum
@ 2022-08-11 16:29 ` Uwe Kleine-König
  2022-09-13  8:37 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Uwe Kleine-König @ 2022-08-11 16:29 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

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

Hello Ahmad,

On Thu, Aug 11, 2022 at 03:58:04PM +0200, Ahmad Fatoum wrote:
> GCC correctly warns that two bit wide compr_type can't
> exceed or be equal to UBIFS_COMPR_TYPES_CNT (== 4).
> 
> Remove the check. The check is there in the kernel as well,
> but the warning is disabled there.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  fs/ubifs/super.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index b48e21fae636..6a0074bd1a5c 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -86,11 +86,6 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
>  		return 1;
>  	}
>  
> -	if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) {
> -		ubifs_err(c, "unknown compression type %d", ui->compr_type);
> -		return 2;
> -	}
> -

I taked to Richard Weinberger about this check in the kernel via irc:

1656326473 < ukleinek> derRichard: I don't feel like increasing my
	kernel patch count, so I'm just reporting here:
	https://lore.barebox.org/20220624081628.GD1615@pengutronix.de
1656326538 <@derRichard> oh
1656326817 <@derRichard> yeah looks like we need to enlarge struct
	ubifs_inode
1656327489 < sha> derRichard: Only when the next compression type comes
1656327499 < sha> derRichard: For now it's enough to remove the check
1656328989 <@derRichard> sha: yeah, i'd rather keep the check.
1656329007 <@derRichard> if we add a new type we'll forget to re-add the
	check for sure
1656330552 < sha> derRichard: Ah, I thought the on-flash format has two
	bits, but it's only the in-memory structures. Then we can change
	the width to 3 bits without problem
1656331100 <@derRichard> exactly
1656331149 <@derRichard> i think it is anyway time ot reevaluate the
	bitfields in struct ubifs_inode, i'm not so sure whether they
	really pay off these days

Given the kernel wants to keep the check, maybe it's easier to keep it
in barebox, too?!

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] fs: ubifs: remove always-false check
  2022-08-11 13:58 [PATCH] fs: ubifs: remove always-false check Ahmad Fatoum
  2022-08-11 16:29 ` Uwe Kleine-König
@ 2022-09-13  8:37 ` Sascha Hauer
  2022-09-13  8:47   ` Ahmad Fatoum
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2022-09-13  8:37 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox, ukl

On Thu, Aug 11, 2022 at 03:58:04PM +0200, Ahmad Fatoum wrote:
> GCC correctly warns that two bit wide compr_type can't
> exceed or be equal to UBIFS_COMPR_TYPES_CNT (== 4).
> 
> Remove the check. The check is there in the kernel as well,
> but the warning is disabled there.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  fs/ubifs/super.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index b48e21fae636..6a0074bd1a5c 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -86,11 +86,6 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
>  		return 1;
>  	}
>  
> -	if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) {
> -		ubifs_err(c, "unknown compression type %d", ui->compr_type);
> -		return 2;
> -	}
> -

Although Richard decided for the Kernel to keep the check I decided to
take this patch for barebox. The warning is annoying and doesn't tell us
anything. Once this is solved in the Kernel we'll get the solution with
the next UBIFS sync.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

* Re: [PATCH] fs: ubifs: remove always-false check
  2022-09-13  8:37 ` Sascha Hauer
@ 2022-09-13  8:47   ` Ahmad Fatoum
  0 siblings, 0 replies; 4+ messages in thread
From: Ahmad Fatoum @ 2022-09-13  8:47 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox, ukl

On 13.09.22 10:37, Sascha Hauer wrote:
> On Thu, Aug 11, 2022 at 03:58:04PM +0200, Ahmad Fatoum wrote:
>> GCC correctly warns that two bit wide compr_type can't
>> exceed or be equal to UBIFS_COMPR_TYPES_CNT (== 4).
>>
>> Remove the check. The check is there in the kernel as well,
>> but the warning is disabled there.
>>
>> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
>> ---
>>  fs/ubifs/super.c | 5 -----
>>  1 file changed, 5 deletions(-)
>>
>> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
>> index b48e21fae636..6a0074bd1a5c 100644
>> --- a/fs/ubifs/super.c
>> +++ b/fs/ubifs/super.c
>> @@ -86,11 +86,6 @@ static int validate_inode(struct ubifs_info *c, const struct inode *inode)
>>  		return 1;
>>  	}
>>  
>> -	if (ui->compr_type >= UBIFS_COMPR_TYPES_CNT) {
>> -		ubifs_err(c, "unknown compression type %d", ui->compr_type);
>> -		return 2;
>> -	}
>> -
> 
> Although Richard decided for the Kernel to keep the check I decided to
> take this patch for barebox. The warning is annoying and doesn't tell us
> anything. Once this is solved in the Kernel we'll get the solution with
> the next UBIFS sync.

My thoughts exactly.

Cheers,
Ahmad

> 
> Sascha
> 


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2022-09-13  8:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-11 13:58 [PATCH] fs: ubifs: remove always-false check Ahmad Fatoum
2022-08-11 16:29 ` Uwe Kleine-König
2022-09-13  8:37 ` Sascha Hauer
2022-09-13  8:47   ` Ahmad Fatoum

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