All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read()
@ 2020-01-24 10:15 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-01-24 10:15 UTC (permalink / raw)
  To: Russell King
  Cc: Al Viro, Kate Stewart, Enrico Weigelt, linux-kernel, kernel-janitors

This code accidentally returns success, but it should return the
-EIO error code from adfs_fplus_validate_header().

Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/adfs/dir_fplus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index 48ea299b6ece..4a15924014da 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -114,7 +114,8 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
 		return ret;
 
 	dir->bighead = h = (void *)dir->bhs[0]->b_data;
-	if (adfs_fplus_validate_header(h)) {
+	ret = adfs_fplus_validate_header(h);
+	if (ret) {
 		adfs_error(sb, "dir %06x has malformed header", indaddr);
 		goto out;
 	}
-- 
2.11.0


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

* [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read()
@ 2020-01-24 10:15 ` Dan Carpenter
  0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2020-01-24 10:15 UTC (permalink / raw)
  To: Russell King
  Cc: Al Viro, Kate Stewart, Enrico Weigelt, linux-kernel, kernel-janitors

This code accidentally returns success, but it should return the
-EIO error code from adfs_fplus_validate_header().

Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 fs/adfs/dir_fplus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index 48ea299b6ece..4a15924014da 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -114,7 +114,8 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
 		return ret;
 
 	dir->bighead = h = (void *)dir->bhs[0]->b_data;
-	if (adfs_fplus_validate_header(h)) {
+	ret = adfs_fplus_validate_header(h);
+	if (ret) {
 		adfs_error(sb, "dir %06x has malformed header", indaddr);
 		goto out;
 	}
-- 
2.11.0

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

* Re: [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read()
  2020-01-24 10:15 ` Dan Carpenter
  (?)
@ 2020-01-25  9:29 ` Russell King - ARM Linux admin
  2020-01-25 16:32   ` Al Viro
  -1 siblings, 1 reply; 5+ messages in thread
From: Russell King - ARM Linux admin @ 2020-01-25  9:29 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Al Viro, Kate Stewart, Enrico Weigelt, linux-kernel, kernel-janitors

On Fri, Jan 24, 2020 at 01:15:37PM +0300, Dan Carpenter wrote:
> This code accidentally returns success, but it should return the
> -EIO error code from adfs_fplus_validate_header().
> 
> Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Good catch.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>

Al, please apply, thanks.

> ---
>  fs/adfs/dir_fplus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
> index 48ea299b6ece..4a15924014da 100644
> --- a/fs/adfs/dir_fplus.c
> +++ b/fs/adfs/dir_fplus.c
> @@ -114,7 +114,8 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
>  		return ret;
>  
>  	dir->bighead = h = (void *)dir->bhs[0]->b_data;
> -	if (adfs_fplus_validate_header(h)) {
> +	ret = adfs_fplus_validate_header(h);
> +	if (ret) {
>  		adfs_error(sb, "dir %06x has malformed header", indaddr);
>  		goto out;
>  	}
> -- 
> 2.11.0
> 
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

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

* Re: [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read()
  2020-01-25  9:29 ` Russell King - ARM Linux admin
@ 2020-01-25 16:32   ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2020-01-25 16:32 UTC (permalink / raw)
  To: Russell King - ARM Linux admin
  Cc: Dan Carpenter, Kate Stewart, Enrico Weigelt, linux-kernel,
	kernel-janitors

On Sat, Jan 25, 2020 at 09:29:30AM +0000, Russell King - ARM Linux admin wrote:
> On Fri, Jan 24, 2020 at 01:15:37PM +0300, Dan Carpenter wrote:
> > This code accidentally returns success, but it should return the
> > -EIO error code from adfs_fplus_validate_header().
> > 
> > Fixes: d79288b4f61b ("fs/adfs: bigdir: calculate and validate directory checkbyte")
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> Good catch.
> 
> Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
> 
> Al, please apply, thanks.

Applied and pushed out.

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

* [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read()
@ 2021-05-19 10:18 Yang Li
  0 siblings, 0 replies; 5+ messages in thread
From: Yang Li @ 2021-05-19 10:18 UTC (permalink / raw)
  To: rmk+kernel; +Cc: linux-kernel, Yang Li

This code accidentally returns 0, but it should return the
-EIO error code to show a I/O error.

Clean up smatch warning:

fs/adfs/dir_fplus.c:146 adfs_fplus_read() warn: missing error code 'ret'

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 fs/adfs/dir_fplus.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/adfs/dir_fplus.c b/fs/adfs/dir_fplus.c
index 4a15924..4334279 100644
--- a/fs/adfs/dir_fplus.c
+++ b/fs/adfs/dir_fplus.c
@@ -143,6 +143,7 @@ static int adfs_fplus_read(struct super_block *sb, u32 indaddr,
 
 	if (adfs_fplus_checkbyte(dir) != t->bigdircheckbyte) {
 		adfs_error(sb, "dir %06x checkbyte mismatch\n", indaddr);
+		ret = -EIO;
 		goto out;
 	}
 
-- 
1.8.3.1


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

end of thread, other threads:[~2021-05-19 10:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24 10:15 [PATCH] fs/adfs: bigdir: Fix an error code in adfs_fplus_read() Dan Carpenter
2020-01-24 10:15 ` Dan Carpenter
2020-01-25  9:29 ` Russell King - ARM Linux admin
2020-01-25 16:32   ` Al Viro
2021-05-19 10:18 Yang Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.