lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 09 Jun 2017 15:11:14 +0300
From:   Antti Palosaari <crope@....fi>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>
Cc:     Mauro Carvalho Chehab <mchehab@...nel.org>,
        linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-media-owner@...r.kernel.org
Subject: Re: [media-af9013] question about return value in function
 af9013_wr_regs()

Gustavo A. R. Silva kirjoitti 2017-06-09 00:51:
> Hello everybody,
> 
> While looking into Coverity ID 1227035 I ran into the following piece
> of code at drivers/media/dvb-frontends/af9013.c:595:

> The issue here is that the value stored in variable _ret_ at line 608,
>  is not being evaluated as it happens at line 662, 667, 672 and 677.
> Then after looking into function af9013_wr_regs(), I noticed that this
>  function always returns zero, no matter what, as you can see below:
> 
> 121static int af9013_wr_regs(struct af9013_state *priv, u16 reg, const  
> u8 *val,
> 122        int len)
> 123{
> 124        int ret, i;
> 125        u8 mbox = (0 << 7)|(0 << 6)|(1 << 1)|(1 << 0);
> 126
> 127        if ((priv->config.ts_mode == AF9013_TS_USB) &&
> 128                ((reg & 0xff00) != 0xff00) && ((reg & 0xff00) != 
> 0xae00)) {
> 129                mbox |= ((len - 1) << 2);
> 130                ret = af9013_wr_regs_i2c(priv, mbox, reg, val, len);
> 131        } else {
> 132                for (i = 0; i < len; i++) {
> 133                        ret = af9013_wr_regs_i2c(priv, mbox, reg+i,
>  val+i, 1);
> 134                        if (ret)
> 135                                goto err;
> 136                }
> 137        }
> 138
> 139err:
> 140        return 0;
> 141}

That function should return error code on error case, not zero always.


regards
Antti




-- 
http://palosaari.fi/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ