Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp1052850pxv; Thu, 22 Jul 2021 21:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1DRYYpGAd5rqS/HJeNKxT8w8hx23vnhYfdCz11UCjOkrqVkYsqKUW8P6NLqJk/ewLprQ+ X-Received: by 2002:a05:6402:1768:: with SMTP id da8mr3297608edb.43.1627012823590; Thu, 22 Jul 2021 21:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627012823; cv=none; d=google.com; s=arc-20160816; b=tGk3TPKZa0PlgdrcP2nDJudjLePHL+M5sBUTqlTcg5gUhenZ1L44ImqflHqj86KZfL 9cFoRreuylyw1mHVk+yS2ZmgrV74fNJeHd1lvRAY9+xum+MCy1FGsLMxdrs3vx5x/erb zWDRUhvYgplQ0A64KwYqiv7ce9VsjK+ax57y3+V6eit7WAEi+hIccM4qONWr2k3n5Tr6 MJgDsMWRGVUNZcQGlJ2F5+WZ7tEfVUSazOso/w5MRuo1r+i38YOzETdSPqtWWEXbaced l9tD2zeyvcslgdYeGlpvxzhQtl7aAVVxSMnSGwmUJtf+8WZc35UhbSpKt0pGSlDkaO35 T/vg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TgIVlP8mWphZrevPLKTT1pO29Yllgf+/zdS1yo306hA=; b=qAHHTfUsHuIgGK7HSgU9tjnkdbLoaUjmS78rySfYpq4iMHl+qTZwnSTAFi2TCAFLQI jPpKfbYM2Q38mpQAWyerTGx0XSsV7bQCGp5snZnlyAIhG53DuFOyQ8ZFJesJbJPQlFj4 QpwGwz7Xk090o/L8tTZHOfs85JJEDLuVLIGpgxMtfUhDQgckLEexl2rXPMYxdpqhpEuS yqZRYELDfzzZs+U09/rBO/06M7cexO5g9eUt8wIq31O9O6Xh/kR38RheLjFoYdA4mc0v ZevWuANHLe7PSbGsMMyLrT9XfsLCxrSiJ8hRuiB0EcKjKbfBn0OeUEW7E/elJC+sQz25 MoEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=POFWSNgs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nc39si9589676ejc.39.2021.07.22.21.00.00; Thu, 22 Jul 2021 21:00:23 -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=k20201202 header.b=POFWSNgs; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233818AbhGWDRd (ORCPT + 99 others); Thu, 22 Jul 2021 23:17:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:37500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233837AbhGWDRJ (ORCPT ); Thu, 22 Jul 2021 23:17:09 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE28260F02; Fri, 23 Jul 2021 03:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1627012663; bh=sLeRchgHxS9aI+LfQZzViXxZ6d3N3CoUQimmi9/VdbM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=POFWSNgs6NeYQTX052EJDBftFjAEXTIY/7nby/1vCrBpb7dC+yGcMclWmqxQwL+kh FICCuXrPCbgLogejzsUTcU2IQkyVFDn/cbiaJrReUjaQrV5bBDMC945PXE5GGJWVIa c8xAEQv4QrBnpLaPvRDyXfCykJLOpB2hxO7C+rTD2WAxq6L0nueRHOOmdELIL1Mxgf iHGQxggb/tnSvk8kfwVYLGxs9WrRghgstp1+OD6VMBiCTSyzKajezv+8cqtOqQQaPn pKyK6MRbPziSS2BY5pjxYYSUR804iHksH4InT7mBt0app3EMzK0558OASOZOHr3BOf keXiNGed0L3cw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hyunchul Lee , Steve French , Sasha Levin , linux-cifs@vger.kernel.org, samba-technical@lists.samba.org Subject: [PATCH AUTOSEL 5.13 16/19] cifs: fix the out of range assignment to bit fields in parse_server_interfaces Date: Thu, 22 Jul 2021 23:57:17 -0400 Message-Id: <20210723035721.531372-16-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210723035721.531372-1-sashal@kernel.org> References: <20210723035721.531372-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hyunchul Lee [ Upstream commit c9c9c6815f9004ee1ec87401ed0796853bd70f1b ] Because the out of range assignment to bit fields are compiler-dependant, the fields could have wrong value. Signed-off-by: Hyunchul Lee Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/smb2ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c index 903de7449aa3..1e5b707833aa 100644 --- a/fs/cifs/smb2ops.c +++ b/fs/cifs/smb2ops.c @@ -555,8 +555,8 @@ parse_server_interfaces(struct network_interface_info_ioctl_rsp *buf, p = buf; while (bytes_left >= sizeof(*p)) { info->speed = le64_to_cpu(p->LinkSpeed); - info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE); - info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE); + info->rdma_capable = le32_to_cpu(p->Capability & RDMA_CAPABLE) ? 1 : 0; + info->rss_capable = le32_to_cpu(p->Capability & RSS_CAPABLE) ? 1 : 0; cifs_dbg(FYI, "%s: adding iface %zu\n", __func__, *iface_count); cifs_dbg(FYI, "%s: speed %zu bps\n", __func__, info->speed); -- 2.30.2