Re: [PATCH 2/5] 9p: virtio: fix unlikely null pointer deref in handle_rerror

From: Simon Horman
Date: Tue May 02 2023 - 11:28:59 EST


On Thu, Apr 27, 2023 at 08:23:35PM +0900, Dominique Martinet wrote:
> handle_rerror can dereference the pages pointer, but it is not
> necessarily set for small payloads.
> In practice these should be filtered out by the size check, but
> might as well double-check explicitly.
>
> This fixes the following scan-build warnings:
> net/9p/trans_virtio.c:401:24: warning: Dereference of null pointer [core.NullDereference]
> memcpy_from_page(to, *pages++, offs, n);
> ^~~~~~~~
> net/9p/trans_virtio.c:406:23: warning: Dereference of null pointer (loaded from variable 'pages') [core.NullDereference]
> memcpy_from_page(to, *pages, offs, size);
> ^~~~~~
>
> Signed-off-by: Dominique Martinet <asmadeus@xxxxxxxxxxxxx>

Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>