lkml.org 
[lkml]   [2023]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Subjectdrivers/gpu/drm/bridge/fsl-ldb.c:101: possible loss of information.
Date
Hello there,

I just ran the static analyser "cppcheck" over the source code of linux-6.2-rc1. It said:

linux-6.3-rc1/drivers/gpu/drm/bridge/fsl-ldb.c:101:3: style: int result is returned as long value. If the return value is long to avoid loss of information, then you have loss of information. [truncLongCastReturn]

Source code is

static unsigned long fsl_ldb_link_frequency(struct fsl_ldb *fsl_ldb, int clock)
{
if (fsl_ldb->lvds_dual_link)
return clock * 3500;
else
return clock * 7000;
}

Depending on the range of the value of clock, maybe unsigned long literals, like 3500UL, should
have been used ?

Regards

David Binderman




\
 
 \ /
  Last update: 2023-03-27 00:47    [W:0.070 / U:1.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site