From: Banajit Goswami Subject: Re: [PATCH] ALSA: pcm: Check for integer overflow during multiplication Date: Sun, 2 Jun 2019 21:43:41 -0700 Message-ID: References: <1559021223-28674-1-git-send-email-bgoswami@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 0C564F80774 for ; Mon, 3 Jun 2019 06:43:57 +0200 (CEST) In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" To: Takashi Iwai Cc: alsa-devel@alsa-project.org, plai@codeaurora.org, broonie@kernel.org, srinivas.kandagatla@linaro.org, Phani Kumar Uppalapati List-Id: alsa-devel@alsa-project.org Thanks Takashi for the review! On 5/27/2019 10:47 PM, Takashi Iwai wrote: > On Tue, 28 May 2019 07:27:03 +0200, > wrote: >> From: Phani Kumar Uppalapati >> >> Channel info data structure is parsed from userspace and if >> the number of channels is not set correctly, it could lead >> to integer overflow when the number of channels is multiplied >> with pcm bit width. Add a condition to check for integer >> overflow during the multiplication operationi, and return error >> if overflow detected. >> >> Signed-off-by: Phani Kumar Uppalapati >> Signed-off-by: Banajit Goswami > Did you really hit this? This was reported by static analysis tool. I will take your feedback, and re-look at the issue, to see if this issue can happen. > The info->channel value is already checked in snd_pcm_channel_info() > before calling the ioctl ops, to the upper bound runtime->channels. > So it shouldn't overflow at the point you suggested. > > > thanks, > > Takashi -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project