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=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 3FBD8C2D0DB for ; Fri, 24 Jan 2020 11:40:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 09C2C206D4 for ; Fri, 24 Jan 2020 11:40:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579866000; bh=YdAfbQfol7iLVmy1tcVmFriFRtKJyYqLD0iEgrL2Xkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=C7TH/magStQ2JvbBO/6D+r5uznUakiE42NhU97I7VvRoOwFb3Ydy+YhKk6pytld0k YtNOqxvr828Ec/rnCxWVz+48W5gNTHTg6FztAjI37xwC/fsSzpjS9qZRe9txUGgKFq wPmqKU3wOwXnMFb65qJA04+7rZ3AaV7ASY+IphAU= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732546AbgAXLj7 (ORCPT ); Fri, 24 Jan 2020 06:39:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:35684 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391302AbgAXLXS (ORCPT ); Fri, 24 Jan 2020 06:23:18 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (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 70F8A2075D; Fri, 24 Jan 2020 11:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864998; bh=YdAfbQfol7iLVmy1tcVmFriFRtKJyYqLD0iEgrL2Xkc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKkt3B4v4L4k22rIcE0bj58+0rF16/7sENjVQKbw4yyRUBVqVTiqLA1NVbeqXVNT6 hGfZqgqkkA4GWvfH5vbEP3nqL7jlFidaewsO24UaNShTv+SJY0v5ck4DKBfBX9G943 kk//ykEpzkpSU5Cipcb9FvSY1o9gifHCs0ryyQps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Logan Gunthorpe , Jon Mason , Sasha Levin Subject: [PATCH 4.19 424/639] ntb_hw_switchtec: potential shift wrapping bug in switchtec_ntb_init_sndev() Date: Fri, 24 Jan 2020 10:29:54 +0100 Message-Id: <20200124093140.149032964@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@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 ff148d8ac53e59802645bd3200c811620317eb9f ] This code triggers a Smatch warning: drivers/ntb/hw/mscc/ntb_hw_switchtec.c:884 switchtec_ntb_init_sndev() warn: should '(1 << sndev->peer_partition)' be a 64 bit type? The "part_map" and "tpart_vec" variables are u64 type so this seems like a valid warning. Fixes: 3df54c870f52 ("ntb_hw_switchtec: Allow using Switchtec NTB in multi-partition setups") Signed-off-by: Dan Carpenter Reviewed-by: Logan Gunthorpe Signed-off-by: Jon Mason Signed-off-by: Sasha Levin --- drivers/ntb/hw/mscc/ntb_hw_switchtec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c index 9916bc5b6759a..313f6258c4249 100644 --- a/drivers/ntb/hw/mscc/ntb_hw_switchtec.c +++ b/drivers/ntb/hw/mscc/ntb_hw_switchtec.c @@ -899,7 +899,7 @@ static int switchtec_ntb_init_sndev(struct switchtec_ntb *sndev) } sndev->peer_partition = ffs(tpart_vec) - 1; - if (!(part_map & (1 << sndev->peer_partition))) { + if (!(part_map & (1ULL << sndev->peer_partition))) { dev_err(&sndev->stdev->dev, "ntb target partition is not NT partition\n"); return -ENODEV; -- 2.20.1