From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758042AbdJMLqf (ORCPT ); Fri, 13 Oct 2017 07:46:35 -0400 Received: from mga06.intel.com ([134.134.136.31]:34943 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751889AbdJMLqe (ORCPT ); Fri, 13 Oct 2017 07:46:34 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.43,370,1503385200"; d="scan'208";a="909604438" Date: Fri, 13 Oct 2017 14:42:10 +0300 From: Mika Westerberg To: Dan Carpenter Cc: Andreas Noever , Michael Jamet , Yehezkel Bernat , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] thunderbolt: Fix some right shifting to zero bugs Message-ID: <20171013114210.GE2761@lahna.fi.intel.com> References: <20171013112959.sc2pwazrpk7fxbtw@mwanda> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171013112959.sc2pwazrpk7fxbtw@mwanda> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 13, 2017 at 02:29:59PM +0300, Dan Carpenter wrote: > The problematic code looks like this: > > res_seq = res_hdr->xd_hdr.length_sn & TB_XDOMAIN_SN_MASK; > res_seq >>= TB_XDOMAIN_SN_SHIFT; > > TB_XDOMAIN_SN_SHIFT is 27, and right shifting a u8 27 bits is always > going to result in zero. The fix is to declare these variables as u32. > > Fixes: d1ff70241a27 ("thunderbolt: Add support for XDomain discovery protocol") I think this requires two patches as the drivers/net/thunderbolt.c is added by another commit. Also please CC netdev@vger.kernel.org and David Miller as the patches are in his net-next tree. The fixes themselves look good, though.