From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5480FFA372C for ; Fri, 8 Nov 2019 11:38:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1E64D222C2 for ; Fri, 8 Nov 2019 11:38:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573213090; bh=yZHetACKVRtNetBPPdhjKthBtWVOXjiKVm+J2t0m8xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HwyVV4DxWApqd55Vub+CcbbVflrfToOUgh7AhHWZohxXyrFQl3U+9e2WjwVFOKs9f yd1URRU716MfYHvI8GPFTxYAKieo5lImLDt+cQwpO9fZBdMWRwznKRzlzOnZlbEtuV 3CpN+lwlXh0HnNfcfjFV1sp9kRj7llAUV1N43lD8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732228AbfKHLiJ (ORCPT ); Fri, 8 Nov 2019 06:38:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:50940 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732127AbfKHLiG (ORCPT ); Fri, 8 Nov 2019 06:38:06 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F398E21D7E; Fri, 8 Nov 2019 11:38:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1573213085; bh=yZHetACKVRtNetBPPdhjKthBtWVOXjiKVm+J2t0m8xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F6SGZ5aWhC2mlRl/QQlJdrEXEZaQbI+M/VOcs5vBDWCXBEHPz96U/jGvZ+Z/K7nEP wv0tgNHaO46qytqyEpFKqT58A5qRc+GKZNl60eDDxnkTVvpCAN9XyNaMZf6u32cS0Y atxjoJ+gCYhzKSx4JNIZ4j9WoIEAf0EovcDna+VM= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Dan Carpenter , Takashi Iwai , Sasha Levin Subject: [PATCH AUTOSEL 4.19 011/205] ALSA: pcm: signedness bug in snd_pcm_plug_alloc() Date: Fri, 8 Nov 2019 06:34:38 -0500 Message-Id: <20191108113752.12502-11-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191108113752.12502-1-sashal@kernel.org> References: <20191108113752.12502-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dan Carpenter [ Upstream commit 6f128fa41f310e1f39ebcea9621d2905549ecf52 ] The "frames" variable is unsigned so the error handling doesn't work properly. Signed-off-by: Dan Carpenter Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/core/oss/pcm_plugin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 71571d9921598..31cb2acf8afcc 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -111,7 +111,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) while (plugin->next) { if (plugin->dst_frames) frames = plugin->dst_frames(plugin, frames); - if (snd_BUG_ON(frames <= 0)) + if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) return -ENXIO; plugin = plugin->next; err = snd_pcm_plugin_alloc(plugin, frames); @@ -123,7 +123,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) while (plugin->prev) { if (plugin->src_frames) frames = plugin->src_frames(plugin, frames); - if (snd_BUG_ON(frames <= 0)) + if (snd_BUG_ON((snd_pcm_sframes_t)frames <= 0)) return -ENXIO; plugin = plugin->prev; err = snd_pcm_plugin_alloc(plugin, frames); -- 2.20.1