[SeaBIOS] [PATCH 3/5] nvme: fix reversed loop condition in cmd_readwrite
Philippe Mathieu-Daudé
f4bug at amsat.org
Wed Mar 1 12:13:38 CET 2017
On 02/24/2017 03:27 AM, Daniel Verkamp wrote:
> It looks like the intent was to exit the loop if a command failed, but
> the current code would actually continue looping in that case.
>
> Signed-off-by: Daniel Verkamp <daniel at drv.nu>
Reviewed-by: Philippe Mathieu-Daudé <f4bug at amsat.org>
> ---
> src/hw/nvme.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/hw/nvme.c b/src/hw/nvme.c
> index c194f9f..97b05cb 100644
> --- a/src/hw/nvme.c
> +++ b/src/hw/nvme.c
> @@ -571,7 +571,7 @@ nvme_cmd_readwrite(struct nvme_namespace *ns, struct disk_op_s *op, int write)
> u16 const max_blocks = NVME_PAGE_SIZE / ns->block_size;
> u16 i;
>
> - for (i = 0; i < op->count || res != DISK_RET_SUCCESS;) {
> + for (i = 0; i < op->count && res == DISK_RET_SUCCESS;) {
> u16 blocks_remaining = op->count - i;
> u16 blocks = blocks_remaining < max_blocks ? blocks_remaining
> : max_blocks;
>
More information about the SeaBIOS
mailing list