Re: Potential uninitialized variables in power: supply: rt5033_battery:

2019-10-13 Thread Yizhuo Zhai
Hi Sebastian: Thanks for your explanation and I will send the patch accordingly. On Sun, Oct 13, 2019 at 8:12 PM Sebastian Reichel wrote: > > Hi, > > On Thu, Oct 03, 2019 at 09:21:44PM -0700, Yizhuo Zhai wrote: > > drivers/power/supply/rt5033_battery.c: &

Re: Potential NULL pointer deference in spi

2019-10-10 Thread Yizhuo Zhai
. On Wed, Oct 9, 2019 at 10:48 PM Eric Dumazet wrote: > > > > On 10/9/19 10:37 PM, Yizhuo Zhai wrote: > > Hi All: > > > > drivers/spi/spi.c: > > > > The function to_spi_device() could return NULL, but some callers > > in this file does not c

Re: [PATCH] staging: sm750fb: Potential uninitialized field in "pll"

2019-10-10 Thread Yizhuo Zhai
t, but it doesn't apply to linux-next any more. Can > you re-write it on top of the most recent staging-next and resend? > > regards, > dan carpenter > -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in spi

2019-10-09 Thread Yizhuo Zhai
. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference inata: sata_rcar

2019-10-09 Thread Yizhuo Zhai
Hi All: In function sata_rcar_bmdma_fill_sg, macro for_each_sg uses sg_next(), which could return NULL as "sg", however, there's no check before dereferencing it (in sg_dma_address()), which is potentially unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student

Potential NULL pointer deference in iwlwifi: mvm

2019-10-09 Thread Yizhuo Zhai
(), iwl_mvm_power_configure_uapsd(), iwl_mvm_power_allow_uapsd(), etc. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in mm/memcontrol.c

2019-10-09 Thread Yizhuo Zhai
(), mem_cgroup_reset(), etc. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in RDMA

2019-10-09 Thread Yizhuo Zhai
, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variable "reg" in clk: axi-clkgen

2019-10-09 Thread Yizhuo Zhai
his case is not easy since the error return is not an acceptable return value for axi_clkgen_recalc_rate(). -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variables in rtc: ds1343

2019-10-09 Thread Yizhuo Zhai
return value -EINVAL is unacceptable for ds1343_show_glitchfilter(). -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variables in cfg80211

2019-10-08 Thread Yizhuo Zhai
ontrol flow, which is potentially unsafe. The patch is hard since we do not know the correct value to initialize them. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in net: sched

2019-10-07 Thread Yizhuo Zhai
Hi All: net/sched/sch_mq.c: Inside function mq_dump_class(), mq_queue_get() could return NULL, however, the return value of dev_queue is not checked and get used. This could potentially be unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California

Potential NULL pointer deference in SFI

2019-10-07 Thread Yizhuo Zhai
Hi All: drivers/sfi/sfi_core.c: Inside function sfi_map_table(), sfi_map_memory() could return NULL, however, the return value of sfi_map_memory() is not checked and get used. This could potentially be unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University

Potential NULL pointer deference in scsi

2019-10-07 Thread Yizhuo Zhai
Hi All: drivers/scsi/scsi.c: Inside function __starget_for_each_device(), dev_to_shost() could return NULL,however, the return value shost is not checked and get used. This could potentially be unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California

Potential NULL pointer deference in scsi: scsi_transport_spi

2019-10-07 Thread Yizhuo Zhai
Hi All: drivers/scsi/scsi_transport_spi.c: Inside function store_spi_transport_period(), dev_to_shost() could return NULL, however, the return value shost is not checked and get used. This could potentially be unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University

Potential NULL pointer deference in iwlwifi: mvm

2019-10-07 Thread Yizhuo Zhai
, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in iwlwifi

2019-10-07 Thread Yizhuo Zhai
, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential NULL pointer deference in cxgbit

2019-10-07 Thread Yizhuo Zhai
Hi All: drivers/target/iscsi/cxgbit/cxgbit_ddp.c: Inside function cxgbit_ddp_sgl_check(), sg_next() could return NULL, however, the return value of sg_next() is not checked and get dereferenced. This could potentially be unsafe. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student

Potential uninitialized variables in regulator: ltc3589

2019-10-03 Thread Yizhuo Zhai
the error code is out of the return type: irqreturn_t. Thanks for your time to check this case. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variables in pwm: stm32-lp

2019-10-03 Thread Yizhuo Zhai
imply return -EINVAL in stm32_pwm_lp_get_state() because the return type is void. Thanks for your time to check this case. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variables in power: supply: rt5033_battery:

2019-10-03 Thread Yizhuo Zhai
imply return -EINVAL in rt5033_battery_get_present() because it's not an acceptable return value. Thanks for your time to check this case. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Potential uninitialized variables in subsys net: hisilicon

2019-10-03 Thread Yizhuo Zhai
L in hip04_reset_ppe() because the return type is void. Thanks for your time to check this case. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] net: hisilicon: Fix usage of uninitialized variable in function mdio_sc_cfg_reg_write()

2019-10-03 Thread Yizhuo Zhai
+ int ret; > > > > regmap_write(mdio_dev->subctrl_vbase, cfg_reg, set_val); > > > Grepping for regmap_{read,write}() shows how big an issue this is. > > I don't know what to do, maybe we can work over time to add checks to > all calls and then force warnings on unchecked return values so that > the problem is not introduced in the future. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] iio: adc: meson-saradc: Variables could be uninitalized if regmap_read() fails

2019-09-29 Thread Yizhuo Zhai
REG3_BL30_INITIALIZED) > > return 0; > > } > > @@ -1014,7 +1028,11 @@ static irqreturn_t meson_sar_adc_irq(int irq, void > > *data) > > unsigned int cnt, threshold; > > u32 regval; > > same as above > > + int ret; > > > > > - regmap_read(priv->regmap, MESON_SAR_ADC_REG0, ); > > + int ret = regmap_read(priv->regmap, MESON_SAR_ADC_REG0, ); > > + ret = regmap_read(priv->regmap, MESON_SAR_ADC_REG0, ); > > > + > > + if (ret) > > + return ret; > > + > > cnt = FIELD_GET(MESON_SAR_ADC_REG0_FIFO_COUNT_MASK, regval); > > threshold = FIELD_GET(MESON_SAR_ADC_REG0_FIFO_CNT_IRQ_MASK, regval); > > > > -- > > 2.17.1 > > -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() could be uninitialized

2019-09-03 Thread Yizhuo Zhai
s just unconditionally assings a value to this variable which will > stop any warnings but there's no analysis explaining why this is a good > fix - are we actually forgetting to check something we should be > checking, are we sure that this is the correct value to use? -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] clocksource: atmel-st: Variable sr in at91rm9200_timer_interrupt() could be uninitialized

2019-09-02 Thread Yizhuo Zhai
quot;); > > + return ret; > > + } > > > > - regmap_read(regmap_st, AT91_ST_SR, ); > > sr &= irqmask; > > > > /* > > -- > > 2.17.1 > > > > -- > Alexandre Belloni, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] extcon: axp288: Variable "val" could be uninitialized if regmap_read() fails

2019-09-02 Thread Yizhuo Zhai
ad(info->regmap, AXP288_PS_BOOT_REASON_REG, ); >> + if (ret) { >> + dev_err(info->dev, "failed to read >> AXP288_PS_BOOT_REASON_REG\n"); >> + return; >> + } >> + >> for (i = 0, rsi = axp288_pwr_up_down_info; *rsi;

Re: [PATCH] net: hisilicon: Variable "reg_value" in function mdio_sc_cfg_reg_write() could be uninitialized

2019-09-02 Thread Yizhuo Zhai
rn ret; > + } > + > reg_value &= st_msk; > if ((!!check_st) == (!!reg_value)) > break; > -- > 2.17.1 > -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] net: stmmac: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized

2019-08-30 Thread Yizhuo Zhai
> be uninitialized if function regmap_read() returns -EINVAL. > > However, it will be used directly in the if statement, which > > is potentially unsafe. > > > > Signed-off-by: Yizhuo > > This doesn't apply to any of my trees. -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] mm/memcg: return value of the function mem_cgroup_from_css() is not checked

2019-08-30 Thread Yizhuo Zhai
Our tool did not trace back the whole path, so, now we could say it might happen. On Thu, Aug 22, 2019 at 1:12 PM Michal Hocko wrote: > > On Thu 22-08-19 13:07:17, Yizhuo Zhai wrote: > > This will happen if variable "wb->memcg_css" is NULL. This case is reported

Re: [PATCH] [media] pvrusb2: qctrl.flag will be uninitlaized if cx2341x_ctrl_query() returns error code

2019-08-26 Thread Yizhuo Zhai
; cx2341x_ctrl_query(>hdw->enc_ctl_state,); > > /* Strip out the const so we can adjust a function pointer. It's > > OK to do this here because we know this is a dynamically created > > > -- Kind Regards, Yizhuo Zhai Computer Science, Graduate Student University of California, Riverside

Re: [PATCH] net: stmmac: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized

2019-02-07 Thread Yizhuo Zhai
Make sense, I will send the new patch. Thanks for the opinion. On Thu, Feb 7, 2019 at 1:25 AM Maxime Ripard wrote: > > On Wed, Feb 06, 2019 at 09:53:16PM -0800, Yizhuo Zhai wrote: > > > > > > On Wed, Feb 6, 2019 at 9:52 PM Yizhuo Zhai wrote: > > > > > &

Re: [PATCH] net: stmmac: Variable "val" in function sun8i_dwmac_set_syscon() could be uninitialized

2019-02-06 Thread Yizhuo Zhai
Thanks, but why initialization matters here? Is performance the main concern? On Wed, Feb 6, 2019 at 9:52 PM Yizhuo Zhai wrote: > > Thanks, but why initialization matters here? Is performance the main concern? > > On Wed, Feb 6, 2019 at 8:17 PM David Miller wrote: >> >&g