Received: by 10.223.164.202 with SMTP id h10csp1035782wrb; Fri, 17 Nov 2017 12:47:09 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ/0g1oVgbG5w8ktxHYxAsX/kmINC7II64mCIr1OXwx9JODEQzQESBpycFgbj8k3SrPNKjj X-Received: by 10.98.58.29 with SMTP id h29mr3315344pfa.121.1510951629331; Fri, 17 Nov 2017 12:47:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510951629; cv=none; d=google.com; s=arc-20160816; b=XktOKbnOrLwBIQsyIhoeERD8ysFuS9h93L3yZAHK56xbMiRLYiSgf7t/DwgOmIlLJM n/Z65hpSfBFy0o6LoQ1BeePb1kG8ecnudpXe1ZI38ZDfissekt5xZ+mHiQTZypu3fD/U JTHwnGOUeRgA17iCXIlKZ+AX8RoQv7xO7Yjbrl/pXrEeMJ4VjRWxrbaGlx9RnV650HaY qjiW8zX/fjmLDC9nfj+f035VavNX8w8RNV4tVnHSl2XxuyS/GjMIjtG3A1YuOX3bZv1u 9EufWI+Ot5ZSBb64gXPgmuU5rlTFkJP4qebdRt+Qr6DmT933ZrDYjvSZsKCj6IxsW299 sgxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:spamdiagnosticmetadata :spamdiagnosticoutput:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature:arc-authentication-results; bh=7M3dtCWLJOhVgTI+0z54huRfIteSpmM8WBd85AZ5Li4=; b=yglT+ht9tuPeNRrNqrtJV2H3NTiaprIo6vQeynkdKMpZPpuXkqG0gfjs5f3qqi3tol //AdhtyCGY2KoKznwR0lYIj+CSp8u1enS+ewrpoD1JO1ojiukoB6f6slyV/O+uqZX4Dq 1W3npdXOvFKTn8OJ5yfMRRK49QfQTIBxgB2zAzbs/VT/RqT9ejVNKhK6sxqRMhXnikuO wf8rXpfiY72FFTPrzKIq62BHE5HtKLeKofG8GM117rmtZkXX+wcnzSpSrXga/z4oSJVC c414ogj8G89aJ+rKEi/31HMj3ULQhVWIQedn3T68z9Vw1sN7zJLnpjnCUxG5ztCmhcU6 dJ7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@unisys.com header.s=selector1 header.b=IJiFkSE+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unisys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w15si3295325pgc.761.2017.11.17.12.46.55; Fri, 17 Nov 2017 12:47:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@unisys.com header.s=selector1 header.b=IJiFkSE+; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=unisys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759955AbdKQR2Q (ORCPT + 93 others); Fri, 17 Nov 2017 12:28:16 -0500 Received: from mail-sn1nam01on0064.outbound.protection.outlook.com ([104.47.32.64]:17148 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751617AbdKQR2I (ORCPT ); Fri, 17 Nov 2017 12:28:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=unisys.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=7M3dtCWLJOhVgTI+0z54huRfIteSpmM8WBd85AZ5Li4=; b=IJiFkSE+7NwQfGAwYTbWmQV4RVdf5+2BZlrcmAV0QDH5mIyqn5VVw5HUSLbsCBPANPSPDeCldb/AosPspg+LdaEH24RVgvMc58ICyOju9kAtoR3cTYjAzJUVhsQDwNyCyGiJfzUO+gJtFLlOD3+tuPoI0BbCI0nfdKtBVq7idsw= Received: from CO2PR07CA0071.namprd07.prod.outlook.com (10.174.192.39) by BY2PR07MB695.namprd07.prod.outlook.com (10.141.225.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Fri, 17 Nov 2017 17:28:05 +0000 Received: from BY2NAM05FT034.eop-nam05.prod.protection.outlook.com (2a01:111:f400:7e52::202) by CO2PR07CA0071.outlook.office365.com (2603:10b6:100::39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Fri, 17 Nov 2017 17:28:05 +0000 Authentication-Results: spf=pass (sender IP is 192.61.61.104) smtp.mailfrom=unisys.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=pass action=none header.from=unisys.com; Received-SPF: Pass (protection.outlook.com: domain of unisys.com designates 192.61.61.104 as permitted sender) receiver=protection.outlook.com; client-ip=192.61.61.104; helo=USEA-NAEDGE1.unisys.com; Received: from USEA-NAEDGE1.unisys.com (192.61.61.104) by BY2NAM05FT034.mail.protection.outlook.com (10.152.100.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.4 via Frontend Transport; Fri, 17 Nov 2017 17:28:04 +0000 Received: from US-EXCH13-1.na.uis.unisys.com (129.224.78.75) by usea-naedge1.unisys.com (192.61.61.104) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Fri, 17 Nov 2017 11:12:18 -0600 Received: from US-EXCH13-2.na.uis.unisys.com (129.224.78.76) by US-EXCH13-1.na.uis.unisys.com (129.224.78.75) with Microsoft SMTP Server (TLS) id 15.0.1293.2; Fri, 17 Nov 2017 11:27:50 -0600 Received: from USEA-NARELAY2.na.uis.unisys.com (129.224.72.20) by US-EXCH13-2.na.uis.unisys.com (129.224.78.76) with Microsoft SMTP Server id 15.0.1293.2 via Frontend Transport; Fri, 17 Nov 2017 11:27:50 -0600 Received: from USTR-ERL-4458.na.uis.unisys.com ([192.62.157.137]) by USEA-NARELAY2.na.uis.unisys.com with Microsoft SMTPSVC(7.5.7601.17514); Fri, 17 Nov 2017 11:27:50 -0600 Received: from kershnda by USTR-ERL-4458.na.uis.unisys.com with local (Exim 4.82) (envelope-from ) id 1eFkQm-0003vC-B3; Fri, 17 Nov 2017 12:27:56 -0500 From: David Kershner To: , , , , , , , CC: Tim Sell Subject: [PATCH 1/2] staging: unisys: visorbus: address theoretical int overflows Date: Fri, 17 Nov 2017 12:27:38 -0500 Message-ID: <1510939659-15039-2-git-send-email-david.kershner@unisys.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510939659-15039-1-git-send-email-david.kershner@unisys.com> References: <1510939659-15039-1-git-send-email-david.kershner@unisys.com> X-OriginalArrivalTime: 17 Nov 2017 17:27:50.0917 (UTC) FILETIME=[64DD5B50:01D35FC9] MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.61.61.104;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(39860400002)(346002)(376002)(2980300002)(438002)(199003)(69234005)(189002)(69596002)(107886003)(106466001)(36756003)(316002)(83796002)(110136005)(57986006)(97736004)(16586007)(2201001)(53936002)(5003940100001)(33646002)(106002)(305945005)(48376002)(72206003)(47776003)(50986999)(356003)(9306002)(50466002)(76176999)(50226002)(4326008)(8936002)(68736007)(81166006)(8676002)(9746002)(81156014)(5660300001)(9786002)(86362001)(478600001)(2950100002)(6666003)(46656002)(189998001)(2906002);DIR:OUT;SFP:1101;SCL:1;SRVR:BY2PR07MB695;H:USEA-NAEDGE1.unisys.com;FPR:;SPF:Pass;PTR:InfoDomainNonexistent;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BY2NAM05FT034;1:kIEMSFa5NrsboSRf/2jGifvN6Vo3oc/VvAoL6n1xJHZSkdmXrKK8oP5njoFUR7fKTjLlaaMq8M5+VqHq4seHnmUn5/+2fDhy0ZEigKGkLetu/+f5PWnF0N6QUQCMa8j5 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f937a068-e5f4-4ee9-5405-08d52de08fc6 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(8251501002)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(2017052603199);SRVR:BY2PR07MB695; X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB695;3:pl2S/UT2WEV6YNvZjwjTRhTcNChpIIwKA3fJhnvDOSokYd6iiUiMXEwe9lmsH8I3tnjtgmeNizTS7QURYYsy5t+KwJpSiiNHQZSEs/FXW1EEhtvE+0bBKhh4nET68/ZDRsFcisOavds4MhUxt8AeQHqkAP85PFQj8Ve9nSDgdw+KU6hVA96x2WEhfAwBuEfrv5EB2QVVKtCYDLi53Cqoj/fH+1mdeqYXeRGkSHCqbfC2yqc2Bs34yLTCV6hzRlQpEa0TOQcvb06mLw7elDvjDGmVxnCCy/WV/pqCKrFf7WrYCV0zA3lU6R5I/zNZsI/0BKe5ETf/vkiLnNXBcyXHMMz7g9ur9fn3NNhAzrv/JHg=;25:oi5fQZfM4a/p++yZhayUp77ZTLwoG29k/3K486sGMFPjkW7+TberH/qWgNmpJcVv8oa4+X3nez93/T6PtxzGDNmnQ+KdXgBAlm3190/j8E8GlKiblw5K9vENdm5kMf+aeKiO0uLkzXkC5+ig53NgQh/65fUBb4Oryq6W+tPeuLuHxp2GkBai9Qej4LPjxMnnxnATTFgOvjQC7wkj1rc7p6hQhEBXkCvQ9bo77P69QEXltkvErwC6lopXWEUaJMDpX97Ir9G70O6K63LsipiYHjW6sjDpoNFVy68EKzBgLwUMzWFqB0TbxkpRXz+GcE2qbzyKFn7sklKJn1IquQCaDQ== X-MS-TrafficTypeDiagnostic: BY2PR07MB695: X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB695;31:xTkFb0zx+On2FNjcXXmB8lTmCS7vh0NcYZojXRZTL6DUHszgWFgk3LnoUTaTBUKr4quRMcDBmzy9JgOoGQ+uSh3JGyq+IMsccABnF7wkvtyYp5DrqwqslHihxxsZN0bfNiIzye0V67rpwGPRqb+22SipaHfIIHkZabbvzO+PHXkOBYMA67OzAsjtnbmkVRMFly0vjkEpMYiTH63ObWHvPD4YQtSrvd9uZhcJNpgj0fg=;20:9l0mZHQnNdPNt0fB05XnsyjfDWBDU0zwVjSDHVClCpfOVKh471ToYIgOo+sKmcoZ8DAf+MhXed/ToZ3cTyjyE3s4DEq1HLo4P8eqPfyK6GodFGscvb+QCw7y7yQDrRVyY4Dp/JK1QcVF3EiEsN3maQyqXyzqSehHBsO9HhroCSDmXAflo02Ad2QchYqs9eyruWdLRyz5tLRRDQk0no2BOzyoN9XJpNT0tCoe31SXqNaS5BUQqvrKQYL3Or1UJu0elK/MxkV95cwfbVA9HL9iyJvmzrFAgbbfGmSQ6Bx/CL3SZcva9KOtIhdE147DNxD+KlP2f+o+N6C/jw/VrIndbc8yt1OP5nS7akCMPRq4cgyWrIDbTNIi5hvLyuvNxPGZso69NH+YWnqrCA2+63RIt4giDu+do27M465fh7egsplY4NsyAeMCFl/fQAnIivcNIi/Dh1b1FZp5CCuFQgaX23yvZZI/wViIX1QTxIn5nRTO1mA8fHviG2dfqV8QyWeu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(174360191007938)(146099531331640); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3002001)(3231022)(10201501046)(93006095)(93004095)(100000703101)(100105400095)(6041248)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(20161123562025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:BY2PR07MB695;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:BY2PR07MB695; X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB695;4:1k23SqPExhldwguLsX++AMmLYebnEFnQQBB5RSy9C8/pe/ZhJxvjaNedPTFZmGKbiItz0H/xAtzaTFzCPfP4XxQk9NEbRYjNg/UxSXCfRbg7nDIdt3zK6QYtMErfJ/3Fep3wONkwEvZEZ2gmBH8Wvnl1s5ZCAKwKpSDIY0x8shEqdbmWQykjq7sPmGJL3Hga8GV8U9JWy9J+UwmGE08iFUoY4tUh1L2XcZnl5t9PLtNZNsuGNp7DPj3Kh0yyY8uezbkh0U+DvQX1nlBOCseaWtZuNx1Gnq8X82eiBkvkGine7ohY4FzHP5rVOamFLfEd5VYwADNbXRU2x2Onc31m1jePvjMyMXrbHU/5mhFf+Qo= X-Forefront-PRVS: 049486C505 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BY2PR07MB695;23:J1NHSkwnkk2+mps4D2AqLebyMZlVYWb9mpTSDiAbCe?= =?us-ascii?Q?HPLCAnZ5B5g70oIsUZcNNGMMIRpUK/qwUPzXQhTrb0NVQRrmfvAAm+NnwLLH?= =?us-ascii?Q?hQxjMUT8Ju9xiY8hTJWYLDOKG3EuEuY1MMIi46OJqjdlrwwqNdqiABTnONx5?= =?us-ascii?Q?msuhwGTYrLPhn96Bs6OiAB5XHq38UwJ0TLdSTpzByvvOiDkEnZy7QmKftWjW?= =?us-ascii?Q?1lixZjBbtpWIt244hilfnpgUxHPdFHTY6qUujhJ4F9VG66s0jDrff6ConaXo?= =?us-ascii?Q?d/75QRypXEfxjc62/GQBZ+Z7LbEmrCxHZfdYEl7yM1sS5+JLGuve5eGLZOol?= =?us-ascii?Q?XixRrmvxTwDyPIDdBvONK0zzKHeNv6+M9Ae/lWXHanAxgI4005x0Qr8J1Yqo?= =?us-ascii?Q?8mVfNztK1zICMh3j78f7l1Z8nS0ex+aMG34dDNGLEyLcUiIX1M0bttvzD6qL?= =?us-ascii?Q?v3RZRH9GNbM5hNVrYrRWgIWMmZ1Ng9f8ezRKLChBud/BVJBOB4chzseAzU7O?= =?us-ascii?Q?17rxsbT1aw+oombraVajYmWpbXrnVs989i70whUMSeTZm/5Mp3iLDn2T301W?= =?us-ascii?Q?r96JqU7M4BLQEnZtI7PGwpVXDxHcqpWlXTjRqsJBmtTnIYNBEovVRRvacTcS?= =?us-ascii?Q?IXn+H8zczymt6k93l3J1e3y/droqTyDtqxBZ6oIopwJpFxG15MGm/86wbDIq?= =?us-ascii?Q?itpdodDihKBwJ4LOJveCnUx7rKQxCpdfUGIBAdIFLCN1+lZTctOMFwMEE9yY?= =?us-ascii?Q?jDMf042D9UhAf0Fy6xUSnacZLk+wMeVe5y/DamChl0PVewRqUh6JhgkK88YZ?= =?us-ascii?Q?LQPw764JbQtN9BSoVFMLxFuS74Qlrd2V5GAEDfQ+W3o/cN0k4iWmd+rSwLyJ?= =?us-ascii?Q?UFuc7ns8YGd760nZI+LUTtFIHyF4xjHTOKWwd+XnHO7JR27jC14L2ZykEe6g?= =?us-ascii?Q?5z9z6oh+q1lrh13JudbbbE0OVnYzcUpZHNHe9qO31mMFZC3Fd8WrPZ3FHPwl?= =?us-ascii?Q?vN3uSKFRiZ1FM8Wig0WT4jz8snWL4iPmHcY6/IuhT5eM1b5yRZ/f3kfraBEf?= =?us-ascii?Q?gbl2eXg+J9UGlixtsqwqIY+vhtH9XlDtyex2P3WjZIHinptLi+mpUXDeRciz?= =?us-ascii?Q?VWZeKsfEitLJRUKKuI5d9YSGWFatB84ca7hTewXsemk6fugk6w6CoxmVkogS?= =?us-ascii?Q?qRWyRhhq+uTWU=3D?= X-Microsoft-Exchange-Diagnostics: 1;BY2PR07MB695;6:NaE4PaoI5PV2ED8mXpK+H8dKI9gplEGI5zIqVkiG2kD0PxLgZz3RpZxtJHcFPJxis/iI837bPUa9OdXla9OmfAmvA7cXOWgdezt0eTl1ywzcEscz7/KlImhZxvLpPVZXFnm8178c5hjh1eoMxLtFwgquPnxxR4kFL1J/yuvvZUa8O3igiWFSmfFCUDyGJ/bNOuK2Lo1ZYwqgvBsvdd5+4Y4Qc7xGBkTzWKVfTHFUZGyg9DuB2f2pL0ANo/LAm4X2rP4hyQSMnko71CIaFmCbLhHS2f4/w26JpJWmrT1oL9NC+t3R6qwQOjXyT/H5QdXoQhEdRG57Gs1XdhoRgsTc9ZGNpCmBY857do73rrhSaWQ=;5:kJkbdWQOLziscJnPTafyERDpjpYMNj1Gy1Z9bQrq0J8igea+rT7zH5RtlPUrO831DFOQFVgDJzLRsITnIBX/ub+/BTXhdvO+14H5VdwS+2F534OpAEA7ZW96F4H/okDiezBu7cUqoh3pyz7i9W4AvOwHNsNQr14Vogi0TduJezQ=;24:S4lJFIshZsbAnk3X/wtuSe9ntXpbqQXoNZBC35VEHsEIoJxM48q/qDpSTiUc1Pplq07aOLxG1wMGEHVzMOUrMCYOSrJm3q10KGPE1B5PSDQ=;7:OrsqVGNiSD+NqPH+M4wjP13rohtBYvHe96t5ww6V2ot8DzfcjbOACOHJMHhHDIoy07yTw/x0XTqL1R6/s/YCzffIWsADD7jLELvgSgI5m/pO7SkSKsojm7q5/Z/JK0tA54VHVJtam5B76fTyCJFeDcMy0BmZbEZlOPZY8lnPJn/wB8DalrfTBvl9OQORCr1b+UJ/kVWjxwHbORxol6VbIzrw/e8ITC9rhI5sYm83FDhEShJaI6sYkG/5SpNlaDun SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: unisys.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Nov 2017 17:28:04.8825 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f937a068-e5f4-4ee9-5405-08d52de08fc6 X-MS-Exchange-CrossTenant-Id: 8d894c2b-238f-490b-8dd1-d93898c5bf83 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=8d894c2b-238f-490b-8dd1-d93898c5bf83;Ip=[192.61.61.104];Helo=[USEA-NAEDGE1.unisys.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB695 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tim Sell Add necessary casting to several places where we were doing 32-bit arithmetic (unsigned) to produce a 64-bit (unsigned long) result, to prevent the theoretical possibility of a 32-bit overflow during the arithmetic. FYI, these are unsigned long: ctx->param_bytes ctx->allocbytes These are unsigned int: bytes phdr->name_offset phdr->name_length Here is the test program demonstrating why we really need the casts: void main() { unsigned int i; unsigned long il; printf("sizeof(int) =%dn",sizeof(i)); printf("sizeof(long)=%dn",sizeof(il)); i = (unsigned int)((((unsigned long)(1)) << 32) - 1); printf("i = %un", i); il = i+1; printf("adding 1 withOUT cast = %lun", il); il = (unsigned long)i+1; printf("adding 1 WITH cast = %lun", il); } [selltc@mac tmp]$ gcc x.c -o x.out [selltc@mac tmp]$ ./x.out sizeof(int) =4 sizeof(long)=8 i = 4294967295 adding 1 withOUT cast = 0 adding 1 WITH cast = 4294967296 Signed-off-by: Tim Sell Reported-by: Dan Carpenter Signed-off-by: David Kershner Reviewed-by: David Binder --- drivers/staging/unisys/visorbus/visorchipset.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index fed554a4..ef2823a 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -590,7 +590,8 @@ static void *parser_name_get(struct parser_context *ctx) struct visor_controlvm_parameters_header *phdr; phdr = &ctx->data; - if (phdr->name_offset + phdr->name_length > ctx->param_bytes) + if ((unsigned long)phdr->name_offset + + (unsigned long)phdr->name_length > ctx->param_bytes) return NULL; ctx->curr = (char *)&phdr + phdr->name_offset; ctx->bytes_remaining = phdr->name_length; @@ -1317,13 +1318,13 @@ static void parser_done(struct parser_context *ctx) static struct parser_context *parser_init_stream(u64 addr, u32 bytes, bool *retry) { - int allocbytes; + unsigned long allocbytes; struct parser_context *ctx; void *mapping; *retry = false; /* alloc an extra byte to ensure payload is \0 terminated */ - allocbytes = bytes + 1 + (sizeof(struct parser_context) - + allocbytes = (unsigned long)bytes + 1 + (sizeof(struct parser_context) - sizeof(struct visor_controlvm_parameters_header)); if ((chipset_dev->controlvm_payload_bytes_buffered + bytes) > MAX_CONTROLVM_PAYLOAD_BYTES) { -- 1.9.1 From 1585391144074054560@xxx Wed Nov 29 09:13:35 +0000 2017 X-GM-THRID: 1585281151451498932 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread