diff mbox series

CIFS: fiemap: do not return EINVAL if get nothing

Message ID 20200314033831.wm7uwy33j3brdgjp@xzhoux.usersys.redhat.com
State New
Headers show
Series CIFS: fiemap: do not return EINVAL if get nothing | expand

Commit Message

Murphy Zhou March 14, 2020, 3:38 a.m. UTC
If we call fiemap on a truncated file with none blocks allocated,
it makes sense we get nothing from this call. No output means
no blocks have been counted, but the call succeeded. It's a valid
response.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 fs/cifs/smb2ops.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Pavel Shilovsky March 14, 2020, 4:26 p.m. UTC | #1
Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>

--
Best regards,
Pavel Shilovsky

пт, 13 мар. 2020 г. в 20:40, Murphy Zhou <jencce.kernel@gmail.com>:
>
> If we call fiemap on a truncated file with none blocks allocated,
> it makes sense we get nothing from this call. No output means
> no blocks have been counted, but the call succeeded. It's a valid
> response.
>
> Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> ---
>  fs/cifs/smb2ops.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index c31e84ee3c39..32b7f9795d4a 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -3417,7 +3417,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
>         if (rc)
>                 goto out;
>
> -       if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
> +       if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
>                 rc = -EINVAL;
>                 goto out;
>         }
> --
> 2.20.1
Steve French March 15, 2020, 4:57 a.m. UTC | #2
merged into cifs-2.6.git for-next

On Sat, Mar 14, 2020 at 8:30 PM Pavel Shilovsky <piastryyy@gmail.com> wrote:
>
> Reviewed-by: Pavel Shilovsky <pshilov@microsoft.com>
>
> --
> Best regards,
> Pavel Shilovsky
>
> пт, 13 мар. 2020 г. в 20:40, Murphy Zhou <jencce.kernel@gmail.com>:
> >
> > If we call fiemap on a truncated file with none blocks allocated,
> > it makes sense we get nothing from this call. No output means
> > no blocks have been counted, but the call succeeded. It's a valid
> > response.
> >
> > Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
> > ---
> >  fs/cifs/smb2ops.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> > index c31e84ee3c39..32b7f9795d4a 100644
> > --- a/fs/cifs/smb2ops.c
> > +++ b/fs/cifs/smb2ops.c
> > @@ -3417,7 +3417,7 @@ static int smb3_fiemap(struct cifs_tcon *tcon,
> >         if (rc)
> >                 goto out;
> >
> > -       if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
> > +       if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
> >                 rc = -EINVAL;
> >                 goto out;
> >         }
> > --
> > 2.20.1
diff mbox series

Patch

diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index c31e84ee3c39..32b7f9795d4a 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -3417,7 +3417,7 @@  static int smb3_fiemap(struct cifs_tcon *tcon,
 	if (rc)
 		goto out;
 
-	if (out_data_len < sizeof(struct file_allocated_range_buffer)) {
+	if (out_data_len && out_data_len < sizeof(struct file_allocated_range_buffer)) {
 		rc = -EINVAL;
 		goto out;
 	}