Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1238530ybg; Wed, 29 Jul 2020 09:05:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTekSBbYTG8R0zGHexIw51rbzEXsbX51/r84GOea2LDdOMdHM2arNH474rGmul5LE+GG87 X-Received: by 2002:a05:6402:1d0a:: with SMTP id dg10mr30467616edb.110.1596038703446; Wed, 29 Jul 2020 09:05:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596038703; cv=none; d=google.com; s=arc-20160816; b=NRgi8vIzvHTwJ/2yJjUz+U8FroIxXllNF/i+rnMGzOyPybCsaT0htJ7g9Ip5Gh3jw8 P2ThXWLbO05AEvlA4znWbhFXbHZwVVmKLgYVYlSwAUW76AeRYFNx8MV6BZQQZxZeFv87 rCvxLqsShWMx44XvTXOKi/d1jzAuUZy8EnAK+Ai34SfmhEHuavOj3oFLlFYC4i70ALzY JFxVVaZITonExCDs75YXpPIG4oMZkTRXN8KAS6/GoB4+OgCCfqYoP6WiiOMr6v+U2ZBe ansim4+hSDJ49GpwiKc9DTIYKx9KuMpFihzlT/G8+6Hjk/UaM5+zJqK0wAliTbfEyHD6 xYpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Q5UK0dXpGZl7Wvvr8ULCIRlnU9N12Yg/y3+30n62a70=; b=BJR4GcUV5x7sq2Je52VIHkx1/Fls6nyIbVfbR7vCnkAWRFbfdw4fkgMHeL3cP2Pv8g /S/9TUDJtohGaez2O9xldbtM0DnCU+1sFtZ1jbRuxGo2apaGUT1JJcdR3/11TBL1+kvE nXneze6Dh1Pl+ZfFYDJ9Phsni2mFys3MP96Mvmc3J+0+X8KJ2zzRiBFsNy/rEKpvCd+K LcCQdivDFxsNlHig8AuA/GNc09qo66QUtYrQKW2GDsmlbQTUvXslE/L5H6XI5R/azCFx 8lE3sDs4YlJEdabrxv0k0Mmed2yF8rp8IM9TOFfyfq77xN0OMdjHcIrauDVuSkTkD7M7 0nuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H63B0KKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w12si1608145edl.141.2020.07.29.09.04.39; Wed, 29 Jul 2020 09:05:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=H63B0KKs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbgG2QDn (ORCPT + 99 others); Wed, 29 Jul 2020 12:03:43 -0400 Received: from mail.kernel.org ([198.145.29.99]:45854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726341AbgG2QDn (ORCPT ); Wed, 29 Jul 2020 12:03:43 -0400 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 215F8206D8; Wed, 29 Jul 2020 16:03:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596038622; bh=VZUYphEQUTYK+8UogBIYPgtkqViD/D0Xw8dBmHZUB3g=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H63B0KKsLXRaZEMqJMzY3dz4ZH/fCmTxVfzOf5H0WnP/kkqDO8WFZEFch22BlY253 2JOo6UlC6YiU79+fj9gs1z0cW6CBjRc1SEipPmRMbC8QyCPeglNLdm2HJ9urPQG1ZI 4cLj/0a3oNrIMMFnesuG4XvoT7r/466u4S2AnmOI= Date: Wed, 29 Jul 2020 18:03:33 +0200 From: Greg Kroah-Hartman To: B K Karthik Cc: Jiri Slaby , linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, "Vabhav Sharma (OSS)" , "bhuvanchandra.dv@toradex.com" Subject: Re: [PATCH v2] tty: serial: fsl_lpuart.c: prevent a bad shift operation Message-ID: <20200729160333.GA3652767@kroah.com> References: <20200721174228.misj2mgqzcfz2lsj@pesu.pes.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200721174228.misj2mgqzcfz2lsj@pesu.pes.edu> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 21, 2020 at 11:12:29PM +0530, B K Karthik wrote: > prevent a bad shift operation by verifying that > the argument to fls is non zero. > > Reported-by: "Vabhav Sharma (OSS)" > Signed-off-by: B K Karthik > --- > v1 -> v2: > added Reported-by tag > > drivers/tty/serial/fsl_lpuart.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c > index 7ca642249224..0cc64279cd2d 100644 > --- a/drivers/tty/serial/fsl_lpuart.c > +++ b/drivers/tty/serial/fsl_lpuart.c > @@ -1168,7 +1168,8 @@ static inline int lpuart_start_rx_dma(struct lpuart_port *sport) > * 10ms at any baud rate. > */ > sport->rx_dma_rng_buf_len = (DMA_RX_TIMEOUT * baud / bits / 1000) * 2; > - sport->rx_dma_rng_buf_len = (1 << (fls(sport->rx_dma_rng_buf_len) - 1)); > + if (sport->rx_dma_rng_buf_len != 0) How can this variable become 0? thanks, greg k-h