From: Clemens Ladisch <clemens@ladisch.de>
To: Nicholas Krause <xerofoify@gmail.com>
Cc: tiwai@suse.de, alsa-devel@alsa-project.org
Subject: Re: [PATCH] sound:pci:Change return type of function, shift_bits in xonar_dg.c to avoid overflow
Date: Thu, 12 Mar 2015 08:49:39 +0100 [thread overview]
Message-ID: <55014513.4030201@ladisch.de> (raw)
In-Reply-To: <1426134946-21167-1-git-send-email-xerofoify@gmail.com>
Nicholas Krause wrote:
> This changes the return type of the function,shift_bits to unsigned
> long in order to avoid overflowing issues with this function when
> called as found when running sparse on the kernel source tree.
sparse is just a tool to help finding problems. The goal is not to do
something to shut it up, but the remove the actual problem.
In this case, if the return type of shift_bits() were a problem, you
would have just moved the problem to its caller where the value is
then returned as unsigned int anyway.
Stop spamming us with patches for code that you do not understand.
Regards,
Clemens
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
> ---
> sound/pci/oxygen/xonar_dg.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
> index 4cf3200..2337a76 100644
> --- a/sound/pci/oxygen/xonar_dg.c
> +++ b/sound/pci/oxygen/xonar_dg.c
> @@ -238,7 +238,7 @@ void set_cs4245_adc_params(struct oxygen *chip,
> cs4245_write_spi(chip, CS4245_MCLK_FREQ);
> }
>
> -static inline unsigned int shift_bits(unsigned int value,
> +static inline unsigned long shift_bits(unsigned int value,
> unsigned int shift_from,
> unsigned int shift_to,
> unsigned int mask)
prev parent reply other threads:[~2015-03-12 7:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-12 4:35 [PATCH] sound:pci:Change return type of function, shift_bits in xonar_dg.c to avoid overflow Nicholas Krause
2015-03-12 6:33 ` [PATCH] sound:pci:Change return type of function,shift_bits " Takashi Iwai
2015-03-12 7:49 ` Clemens Ladisch [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55014513.4030201@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=tiwai@suse.de \
--cc=xerofoify@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox