From patchwork Wed Mar 18 03:14:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 45916 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 92BD721547 for ; Wed, 18 Mar 2015 03:15:32 +0000 (UTC) Received: by lbiz11 with SMTP id z11sf5101342lbi.2 for ; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=Nifa3lk83awrskaObSSEsP2Uor1a/mdbtNTfUlBUU+s=; b=UDSzvRCkBc9q/vp1znmdiasH6oEFY0UY2OJAcriK429mkshOere2DefRaSf7mSu7Q3 JQIsDQod6OCfLe6VvLUYnUxSuKj/u060PkbI/m9h+8xdmzemupnOBm7hvj6hRdwGK528 TG2rjkt6EKUVbd1z90jjKL9f9KCJnfXYCxmNUa+xzmLduEYxzfanIuSoPVYwTA/8KnJs N03nly807xOeqzm5Xx8B+shCS5TtaU0AxXDcQC5WLy0UcGXnzbuW4xPzYrXrg+fyx3F2 RdoyoKQLxj1M7S0Wi63fa1dhWpxLz9MoUR+3LrzhHw9n3OqI6k663K+fbiMQrHnYBfz1 fi2Q== X-Gm-Message-State: ALoCoQnrjnqyy42oT6MBlve4yT5ZrSxZA/JC8Ydg6HGYKPqqit2CEU/z8XJXncG38hE0Ke5F2gaZ X-Received: by 10.112.202.227 with SMTP id kl3mr3898313lbc.2.1426648531498; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.116.116 with SMTP id jv20ls100927lab.34.gmail; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) X-Received: by 10.112.73.65 with SMTP id j1mr61768567lbv.87.1426648531230; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id al5si11912843lbc.80.2015.03.17.20.15.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Mar 2015 20:15:31 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by lamx15 with SMTP id x15so25290145lam.3 for ; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) X-Received: by 10.152.197.34 with SMTP id ir2mr62284560lac.36.1426648531096; Tue, 17 Mar 2015 20:15:31 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp894097lbj; Tue, 17 Mar 2015 20:15:30 -0700 (PDT) X-Received: by 10.66.65.195 with SMTP id z3mr157645672pas.10.1426648517083; Tue, 17 Mar 2015 20:15:17 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id nt3si33087408pdb.180.2015.03.17.20.15.16; Tue, 17 Mar 2015 20:15:17 -0700 (PDT) Received-SPF: none (google.com: stable-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754671AbbCRDPP (ORCPT + 1 other); Tue, 17 Mar 2015 23:15:15 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:18023 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754645AbbCRDPO (ORCPT ); Tue, 17 Mar 2015 23:15:14 -0400 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id t2I3FB3T002987 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 18 Mar 2015 03:15:11 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id t2I3FBwA011759 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Wed, 18 Mar 2015 03:15:11 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by aserv0121.oracle.com (8.13.8/8.13.8) with ESMTP id t2I3FBRg005209; Wed, 18 Mar 2015 03:15:11 GMT Received: from lappy.hsd1.nh.comcast.net (/10.154.120.23) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 17 Mar 2015 20:15:10 -0700 From: Sasha Levin To: stable@vger.kernel.org, stable-commits@vger.kernel.org Cc: Ivan Khoronzhuk , Matt Fleming , Sasha Levin Subject: [added to the 3.18 stable tree] firmware: dmi_scan: Fix dmi_len type Date: Tue, 17 Mar 2015 23:14:07 -0400 Message-Id: <1426648483-4376-11-git-send-email-sasha.levin@oracle.com> X-Mailer: git-send-email 2.1.0 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: stable-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: stable@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Ivan Khoronzhuk This patch has been added to the 3.18 stable tree. If you have any objections, please let us know. =============== [ Upstream commit 6d9ff473317245e3e5cd9922b4520411c2296388 ] According to SMBIOSv3 specification the length of DMI table can be up to 32bits wide. So use appropriate type to avoid overflow. It's obvious that dmi_num theoretically can be more than u16 also, so it's can be changed to u32 or at least it's better to use int instead of u16, but on that moment I cannot imagine dmi structure count more than 65535 and it can require changing type of vars that work with it. So I didn't correct it. Acked-by: Ard Biesheuvel Signed-off-by: Ivan Khoronzhuk Signed-off-by: Matt Fleming Signed-off-by: Sasha Levin --- drivers/firmware/dmi_scan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/firmware/dmi_scan.c b/drivers/firmware/dmi_scan.c index 17afc51..84bc2a5 100644 --- a/drivers/firmware/dmi_scan.c +++ b/drivers/firmware/dmi_scan.c @@ -78,7 +78,7 @@ static const char * __init dmi_string(const struct dmi_header *dm, u8 s) * We have to be cautious here. We have seen BIOSes with DMI pointers * pointing to completely the wrong place for example */ -static void dmi_table(u8 *buf, int len, int num, +static void dmi_table(u8 *buf, u32 len, int num, void (*decode)(const struct dmi_header *, void *), void *private_data) { @@ -108,7 +108,7 @@ static void dmi_table(u8 *buf, int len, int num, } static u32 dmi_base; -static u16 dmi_len; +static u32 dmi_len; static u16 dmi_num; static int __init dmi_walk_early(void (*decode)(const struct dmi_header *,