All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH] simfs: Fix reads beyond the first block
Date: Fri, 30 Jul 2021 10:37:44 -0500	[thread overview]
Message-ID: <352f49b0-d29b-b43e-3658-9879007773c2@gmail.com> (raw)
In-Reply-To: <20210730120751.2682607-1-slava.monich@jolla.com>

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

Hi Slava,

On 7/30/21 7:07 AM, Slava Monich wrote:
> ---
>   src/simfs.c | 17 ++++++++---------
>   1 file changed, 8 insertions(+), 9 deletions(-)
> 

Funny how long this bug has been lurking around.

> diff --git a/src/simfs.c b/src/simfs.c
> index 3d4f6283..cf770265 100644
> --- a/src/simfs.c
> +++ b/src/simfs.c
> @@ -383,18 +383,18 @@ static void sim_fs_op_read_block_cb(const struct ofono_error *error,
>   	}
>   
>   	start_block = op->offset / 256;
> -	end_block = (op->offset + (op->num_bytes - 1)) / 256;
> +	end_block = op->num_bytes ? (op->offset + op->num_bytes - 1) / 256 :
> +								start_block;
>   

Curious why this is needed?  op->num_bytes should never be zero since it gets 
set to the file length?

Rest looks good to me.

Regards,
-Denis

  reply	other threads:[~2021-07-30 15:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30 12:07 [PATCH] simfs: Fix reads beyond the first block Slava Monich
2021-07-30 15:37 ` Denis Kenzior [this message]
2021-07-30 15:52   ` Slava Monich
2021-07-30 16:08     ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=352f49b0-d29b-b43e-3658-9879007773c2@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.