linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Discussion] Uninitialized variable in wiz_mode_select()
@ 2021-04-01  7:33 Muhammad Usama Anjum
  2021-04-01  7:38 ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2021-04-01  7:33 UTC (permalink / raw)
  To: Kishon Vijay Abraham I, Vinod Koul,
	open list:GENERIC PHY FRAMEWORK, open list, kernel-janitors,
	colin.king, dan.carpenter
  Cc: musamaanjum

Hi,

`mode` remains uninitialized when `lane_phy_type` isn't PHY_TYPE_DP
or 
PHY_TYPE_QSGMII. I've checked the dtsi (k3-j721e-common-proc-
board.dts) 
and possible values of `lane_phy_type` are justPHY_TYPE_USB3 and 
PHY_TYPE_PCIE. If this is correct, the mode will remain uninitialized with
garbage value. `mode` should be initialized to what? It seems like it is highly 
implementation dependent.

/drivers/phy/ti/phy-j721e-wiz.c: 344 in wiz_mode_select()
338             for (i = 0; i < num_lanes; i++) {
339                     if (wiz->lane_phy_type[i] == PHY_TYPE_DP)
340                             mode = LANE_MODE_GEN1;
341                     else if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII)
342                             mode = LANE_MODE_GEN2;
343     
>>>     CID 1503592:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "mode" when calling "regmap_field_write".
344                     ret = regmap_field_write(wiz->p_standard_mode[i], mode);
345                     if (ret)
346                             return ret;
347             }
348     
349             return 0;

Thanks,
Usama


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Discussion] Uninitialized variable in wiz_mode_select()
  2021-04-01  7:33 [Discussion] Uninitialized variable in wiz_mode_select() Muhammad Usama Anjum
@ 2021-04-01  7:38 ` Kishon Vijay Abraham I
  2021-04-01  7:39   ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2021-04-01  7:38 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Vinod Koul,
	open list:GENERIC PHY FRAMEWORK, open list, kernel-janitors,
	colin.king, dan.carpenter

Hi Usama,

On 01/04/21 1:03 pm, Muhammad Usama Anjum wrote:
> Hi,
> 
> `mode` remains uninitialized when `lane_phy_type` isn't PHY_TYPE_DP
> or 
> PHY_TYPE_QSGMII. I've checked the dtsi (k3-j721e-common-proc-
> board.dts) 
> and possible values of `lane_phy_type` are justPHY_TYPE_USB3 and 
> PHY_TYPE_PCIE. If this is correct, the mode will remain uninitialized with
> garbage value. `mode` should be initialized to what? It seems like it is highly 
> implementation dependent.
> 
> /drivers/phy/ti/phy-j721e-wiz.c: 344 in wiz_mode_select()
> 338             for (i = 0; i < num_lanes; i++) {
> 339                     if (wiz->lane_phy_type[i] == PHY_TYPE_DP)
> 340                             mode = LANE_MODE_GEN1;
> 341                     else if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII)
> 342                             mode = LANE_MODE_GEN2;
> 343     
>>>>     CID 1503592:  Uninitialized variables  (UNINIT)
>>>>     Using uninitialized value "mode" when calling "regmap_field_write".
> 344                     ret = regmap_field_write(wiz->p_standard_mode[i], mode);
> 345                     if (ret)
> 346                             return ret;
> 347             }
> 348     
> 349             return 0;

I've sent a follow-up patch fixing this.
http://lor.kernel.org/r/20210331131417.15596-1-kishon@ti.com

Thanks
Kishon

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Discussion] Uninitialized variable in wiz_mode_select()
  2021-04-01  7:38 ` Kishon Vijay Abraham I
@ 2021-04-01  7:39   ` Kishon Vijay Abraham I
  0 siblings, 0 replies; 3+ messages in thread
From: Kishon Vijay Abraham I @ 2021-04-01  7:39 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Vinod Koul,
	open list:GENERIC PHY FRAMEWORK, open list, kernel-janitors,
	colin.king, dan.carpenter

Hi,

On 01/04/21 1:08 pm, Kishon Vijay Abraham I wrote:
> Hi Usama,
> 
> On 01/04/21 1:03 pm, Muhammad Usama Anjum wrote:
>> Hi,
>>
>> `mode` remains uninitialized when `lane_phy_type` isn't PHY_TYPE_DP
>> or 
>> PHY_TYPE_QSGMII. I've checked the dtsi (k3-j721e-common-proc-
>> board.dts) 
>> and possible values of `lane_phy_type` are justPHY_TYPE_USB3 and 
>> PHY_TYPE_PCIE. If this is correct, the mode will remain uninitialized with
>> garbage value. `mode` should be initialized to what? It seems like it is highly 
>> implementation dependent.
>>
>> /drivers/phy/ti/phy-j721e-wiz.c: 344 in wiz_mode_select()
>> 338             for (i = 0; i < num_lanes; i++) {
>> 339                     if (wiz->lane_phy_type[i] == PHY_TYPE_DP)
>> 340                             mode = LANE_MODE_GEN1;
>> 341                     else if (wiz->lane_phy_type[i] == PHY_TYPE_QSGMII)
>> 342                             mode = LANE_MODE_GEN2;
>> 343     
>>>>>     CID 1503592:  Uninitialized variables  (UNINIT)
>>>>>     Using uninitialized value "mode" when calling "regmap_field_write".
>> 344                     ret = regmap_field_write(wiz->p_standard_mode[i], mode);
>> 345                     if (ret)
>> 346                             return ret;
>> 347             }
>> 348     
>> 349             return 0;
> 
> I've sent a follow-up patch fixing this.
> http://lor.kernel.org/r/20210331131417.15596-1-kishon@ti.com

Fixed a typo in the link
https://lore.kernel.org/linux-phy/20210331131417.15596-1-kishon@ti.com/

Thanks
Kishon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-01  7:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01  7:33 [Discussion] Uninitialized variable in wiz_mode_select() Muhammad Usama Anjum
2021-04-01  7:38 ` Kishon Vijay Abraham I
2021-04-01  7:39   ` Kishon Vijay Abraham I

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).