[PATCH 3/3] drm/msm/dsi: fix signedness bug in msm_dsi_host_cmd_rx()

Dan Carpenter dan.carpenter at oracle.com
Mon Oct 4 06:18:35 UTC 2021


On Sat, Oct 02, 2021 at 01:59:56AM +0300, Dmitry Baryshkov wrote:
> On 01/10/2021 15:36, Dan Carpenter wrote:
> > The "msg->tx_len" variable is type size_t so if dsi_cmds2buf_tx()
> > returns a negative error code that it type promoted to a high positive
> > value and treat as a success.  The second problem with this code is
> > that it can return meaningless positive values on error.
> 
> It looks to me that this piece of code is not fully correct at all.
> dsi_cmds2bus_tx would return the size of DSI packet, not the size of the DSI
> buffer.
> 
> Could you please be more specific, which 'meaningless positive values' were
> you receiving?
> 

Sorry, I misread the code.  I thought it returned negatives or the
number of bytes copied.  (This is from static analysis btw).  Anyway,
returning only negatives is a much better way.

I will fix this patch and resend.

regards,
dan carpenter



More information about the dri-devel mailing list