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=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 015C3C432C0 for ; Tue, 19 Nov 2019 06:11:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDF2020692 for ; Tue, 19 Nov 2019 06:11:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574143872; bh=yZHetACKVRtNetBPPdhjKthBtWVOXjiKVm+J2t0m8xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KXbfDp2XnQdQ5KndZ+hLESoOvWxLh1sIyKzUQAHt66mLAXfGtRM84YtFk1HSxSn12 6OIX+bC9P3U5B95OoWlzeO336+EnwGmProyzOpBn6IPDN+Tq2vvN1VtRd9GzpIWUay ny8Kltz5+fcNppOxi8Z6OyNDCzJEsgdFBujvU2XQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728301AbfKSFY7 (ORCPT ); Tue, 19 Nov 2019 00:24:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:41586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727604AbfKSFY7 (ORCPT ); Tue, 19 Nov 2019 00:24:59 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E72C121783; Tue, 19 Nov 2019 05:24:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574141098; bh=yZHetACKVRtNetBPPdhjKthBtWVOXjiKVm+J2t0m8xk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oE3zvbEDu4PNl/B83ZzkiAgr2QvPL/pS3Jz2IZKR/RufZxC5zDe0OjvGTwbiy5GY4 28CQjg2LJCt4dy9UWZCQU+VXy93ZtbIo9n2MFSwtwhvW/PozBGBnVEdDRpo6s+jJ06 phHEeO5DQTHK8WD3uXTcqxYbEJcy9LK9Tjlg7R7g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 043/422] ALSA: pcm: signedness bug in snd_pcm_plug_alloc() Date: Tue, 19 Nov 2019 06:14:00 +0100 Message-Id: <20191119051402.709547687@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191119051400.261610025@linuxfoundation.org> References: <20191119051400.261610025@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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