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=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 53032C432BE for ; Fri, 27 Aug 2021 15:41:03 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 22519604D7 for ; Fri, 27 Aug 2021 15:41:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 22519604D7 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 791AA16AC; Fri, 27 Aug 2021 17:40:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 791AA16AC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1630078860; bh=kNJSbFlCehepjwfQ+Pqp0pkzZNiQMG9KMYwYHHkOJQU=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OwZSkvcIvy3qJbFh0Ondg9KhQ8xvroYB6PMycSE4u7PhWWvh/HjwHTqobXlEbsqPJ AxNZGtgfhYCHbBXWoYNF/yAYXFNlemJXd4GJb00JbnHk5oiUwT9h1L41sWYaCQea5q 3eKbfF40Zvw7nvf6DeTmKecU9VYyfsmqGilrZLTo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 25D6DF80107; Fri, 27 Aug 2021 17:40:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1DAB4F80129; Fri, 27 Aug 2021 17:40:08 +0200 (CEST) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id A1E4FF800FD for ; Fri, 27 Aug 2021 17:39:55 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A1E4FF800FD Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="dWX0eNZz" Received: by mail-pj1-x1032.google.com with SMTP id oc2-20020a17090b1c0200b00179e56772d6so9141405pjb.4 for ; Fri, 27 Aug 2021 08:39:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hMuWH5EcDyaVARhDQbZOccIQ+VjBBxiLtLIni/BW1kA=; b=dWX0eNZzXXimz0SyRiCP5fUZ9A720kHKv0KmP1ScSImOfn4aLL10wRRZ9YuMeQOrrQ 82jw9FlvSBemaOu9odYXearzlnJaXXEI7UzGwHNynQAACwOsuDOQNhC7ryq+6SToM9GU EejAnRP75MSp4rcco0OH37oSQW6Anwu6AFJgo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hMuWH5EcDyaVARhDQbZOccIQ+VjBBxiLtLIni/BW1kA=; b=p2EY5pT6DtEWsYuKzCR+Kd7t20XWpMp29aS8ZXngmiP8nlNnZAwbSOS80aAeAl9N5H CsM+7MvBKqJYxvhmFjyUBlvGSSSwclbLt02gnErlFqOHrZDbiLmW92AJU0HZ1+TWyQqA OlPvnmR15P4hQPKE4jInwT/9pKYLCq9GORMzjzfV1RbNQMjTrqUpsjHlmZNSQxPYVmJ8 jsz2jr20TTqlYeUPacMxKb3gd7A7VIp9QXWUSCayTGaKworH6pgd93KU82BHHPtKam3I kGYFLfcbvRm+8tNH6eHl4YmwoH9X3jb79++qaLd+OUIktQ6EqMXycHkqMkQ2oQFtTApR OFhQ== X-Gm-Message-State: AOAM531sPjHdIiC3aloUaaBDarWY10vM9HFhN09IVew+zsffDkIsECeg t8tl41ObroF3+Q51+lmxp3O/Kw== X-Google-Smtp-Source: ABdhPJzFokkTsbhLDyuDu/TTYkx4iDytznSen4Jp2AAcCTfjAlWV0k3q7niIhbn7cER6SHebF1k24w== X-Received: by 2002:a17:90b:188f:: with SMTP id mn15mr23921207pjb.154.1630078792860; Fri, 27 Aug 2021 08:39:52 -0700 (PDT) Received: from google.com ([2620:15c:202:201:48c6:7176:3bae:a573]) by smtp.googlemail.com with ESMTPSA id 10sm7165381pjc.41.2021.08.27.08.39.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 08:39:52 -0700 (PDT) Date: Fri, 27 Aug 2021 08:39:48 -0700 From: Zubin Mithra To: Takashi Iwai Subject: Re: [PATCH] ALSA: pcm: fix divide error in snd_pcm_lib_ioctl Message-ID: References: <20210827004821.3658015-1-zsm@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Cc: groeck@chromium.org, alsa-devel@alsa-project.org, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On Fri, Aug 27, 2021 at 08:05:00AM +0200, Takashi Iwai wrote: > On Fri, 27 Aug 2021 02:48:21 +0200, > Zubin Mithra wrote: > > > > Syzkaller reported a divide error in snd_pcm_lib_ioctl. fifo_size > > is of type snd_pcm_uframes_t(unsigned long). If frame_size > > is 0x100000000, the error occurs. > > > > Fixes: a9960e6a293e ("ALSA: pcm: fix fifo_size frame calculation") > > Signed-off-by: Zubin Mithra > > --- > > sound/core/pcm_lib.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c > > index 7d5883432085..e41b4e01aa37 100644 > > --- a/sound/core/pcm_lib.c > > +++ b/sound/core/pcm_lib.c > > @@ -1746,7 +1746,7 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream, > > channels = params_channels(params); > > frame_size = snd_pcm_format_size(format, channels); > > if (frame_size > 0) > > - params->fifo_size /= (unsigned)frame_size; > > + params->fifo_size /= (unsigned long)frame_size; > > I guess we can drop the cast completely, instead? > It'd be less ugliness. Sounds good, thanks, I've sent out a v2. > > > Thanks! > > Takashi