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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, 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 81393C433DF for ; Thu, 20 Aug 2020 11:55:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5C5A4207BB for ; Thu, 20 Aug 2020 11:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597924549; bh=7hPk/2+7hn0Muf3cezth68O9tHDjtRnM1qmHafdA1NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=iRKJOhy8DiY6TcCz6roWXa57Jk9o3PZz/Uc1lzLPM8QE4r/eUokXEydcXfxvmNmMu KslNcO3JsZzKfvHXsCXP9JEwqMmygyBbu7Oc5ZYX7B1IkEU+R9t3GGMFDgfk6bZNse 6wCEb8NMiHsAJA9peJchJh+WxNpDv9gXPj03PJcY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730112AbgHTLzq (ORCPT ); Thu, 20 Aug 2020 07:55:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:53460 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727937AbgHTKCZ (ORCPT ); Thu, 20 Aug 2020 06:02:25 -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 ACE8622B4B; Thu, 20 Aug 2020 10:02:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597917745; bh=7hPk/2+7hn0Muf3cezth68O9tHDjtRnM1qmHafdA1NU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PpPWDXiDByBqkwNAL4bjjE+NVp3lnFhUwoqP3+iq39NN+QmXpmQvCBpFuBKUV1G0B VsPhHvNm4Z/ygGeeHsxB6xKU79vKKLHqGe8DvXc40D5BTFPHokhes+B6SEgC3kRlcr H1GKcSgBrUra8J8OEjvQLfNVYEs8CzoAEJcT6Guk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florinel Iordache , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 143/212] fsl/fman: use 32-bit unsigned integer Date: Thu, 20 Aug 2020 11:21:56 +0200 Message-Id: <20200820091609.569049959@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200820091602.251285210@linuxfoundation.org> References: <20200820091602.251285210@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Florinel Iordache [ Upstream commit 99f47abd9f7bf6e365820d355dc98f6955a562df ] Potentially overflowing expression (ts_freq << 16 and intgr << 16) declared as type u32 (32-bit unsigned) is evaluated using 32-bit arithmetic and then used in a context that expects an expression of type u64 (64-bit unsigned) which ultimately is used as 16-bit unsigned by typecasting to u16. Fixed by using an unsigned 32-bit integer since the value is truncated anyway in the end. Fixes: 414fd46e7762 ("fsl/fman: Add FMan support") Signed-off-by: Florinel Iordache Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- drivers/net/ethernet/freescale/fman/fman.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/freescale/fman/fman.c b/drivers/net/ethernet/freescale/fman/fman.c index 380c4a2f65161..6a11f9916116c 100644 --- a/drivers/net/ethernet/freescale/fman/fman.c +++ b/drivers/net/ethernet/freescale/fman/fman.c @@ -1446,8 +1446,7 @@ static void enable_time_stamp(struct fman *fman) { struct fman_fpm_regs __iomem *fpm_rg = fman->fpm_regs; u16 fm_clk_freq = fman->state->fm_clk_freq; - u32 tmp, intgr, ts_freq; - u64 frac; + u32 tmp, intgr, ts_freq, frac; ts_freq = (u32)(1 << fman->state->count1_micro_bit); /* configure timestamp so that bit 8 will count 1 microsecond -- 2.25.1