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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210519102947.GU1955@kadam>
Date:   Wed, 19 May 2021 13:29:47 +0300
From:   Dan Carpenter <dan.carpenter@...cle.com>
To:     Rajat Asthana <thisisrast7@...il.com>
Cc:     vaibhav.sr@...il.com, mgreer@...malcreek.com, johan@...nel.org,
        elder@...nel.org, gregkh@...uxfoundation.org,
        greybus-dev@...ts.linaro.org, linux-staging@...ts.linux.dev,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] greybus: audio: Fix sparse warning.

On Wed, May 19, 2021 at 09:46:24AM +0530, Rajat Asthana wrote:
> Enforce int type on SNDRV_CTL_ELEM_IFACE_MIXER to fix sparse warning:
> > warning: restricted snd_ctl_elem_iface_t degrades to integer
> 
> The iface field in the gb_audio_control struct is of type __u8, but the
> values stored in it are of type int. So on conversion they are degraded.
> Adding (__force int) will enforce them not to be degraded.
> 

The patch is fine, but the commit message is not very great.  This
patch doesn't "enforce" anything or affect the compiled code at all,
it just silences a Sparse warning.  Here is a better commit message.

  Sparse complains that:

    warning: restricted snd_ctl_elem_iface_t degrades to integer

  I have looked at this code, and the code is fine as-is.  Normally
  we would frown on using the __force directive to silence Sparse
  warnings but in this case it's fine.  Case statements can't be
  made into __bitwise types.  We also can't change the type of
  "ctl->iface" either because that is part of the user space API.

  So just add a (__force int) to make the warning go away.

regards,
dan carpenter

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ