From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752810AbbCLGdY (ORCPT ); Thu, 12 Mar 2015 02:33:24 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41023 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751775AbbCLGdV (ORCPT ); Thu, 12 Mar 2015 02:33:21 -0400 Date: Thu, 12 Mar 2015 07:33:20 +0100 Message-ID: From: Takashi Iwai To: Nicholas Krause Cc: clemens@ladisch.de, perex@perex.cz, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] sound:pci:Change return type of function,shift_bits in xonar_dg.c to avoid overflow In-Reply-To: <1426134946-21167-1-git-send-email-xerofoify@gmail.com> References: <1426134946-21167-1-git-send-email-xerofoify@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.4 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 12 Mar 2015 00:35:46 -0400, 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. What overflows exactly? Did you follow the code? thanks, Takashi > > Signed-off-by: Nicholas Krause > --- > 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) > -- > 2.1.0 >