From patchwork Wed Sep 21 12:25:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Razvan Cojocaru X-Patchwork-Id: 9343429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B9A22607D4 for ; Wed, 21 Sep 2016 12:28:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AB49B2A617 for ; Wed, 21 Sep 2016 12:28:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A01162A61B; Wed, 21 Sep 2016 12:28:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 886272A617 for ; Wed, 21 Sep 2016 12:28:15 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmgbQ-0000EI-SX; Wed, 21 Sep 2016 12:26:16 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bmgbP-0000E7-Ow for xen-devel@lists.xen.org; Wed, 21 Sep 2016 12:26:15 +0000 Received: from [85.158.143.35] by server-3.bemta-6.messagelabs.com id 83/22-04595-76C72E75; Wed, 21 Sep 2016 12:26:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRWlGSWpSXmKPExsUSfTxjoW5azaN wgw0zVSyWfFzM4sDocXT3b6YAxijWzLyk/IoE1oyutmfsBT/ZKm6s/8bYwLiVtYuRk0NIwENi +5vVQDYXkL2WUeL49mPsEM41Ron+f01sEFXuEs+2XWCGSOxnlDj6thEswSZgKLF6YwuYLSIgL XHt82VGEJtZoFZi9tvDYLawgIPEq6PXmUBsFgFVieNf74HZvAKeEi9+bALrlRCQkzh5bDLQGR xAdo7EhaYoCFNK4n+rEkRFF4vE/39VELaMxKOJN9kmMAosYGRYxahRnFpUllqka2ygl1SUmZ5 RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kRGFYMQLCD8e/awEOMkhxMSqK8zx0fhQvxJeWn VGYkFmfEF5XmpBYfYpTh4FCS4D1XDZQTLEpNT61Iy8wBBjhMWoKDR0mEVwAY5EK8xQWJucWZ6 RCpU4y6HAt+3F7LJMSSl5+XKiXOuwFkhgBIUUZpHtwIWLRdYpSVEuZlBDpKiKcgtSg3swRV/h WjOAejkjDva5ApPJl5JXCbXgEdwQR0xJafD0COKElESEk1MDY1x/k/vn9vzhMXCcn+LSt2KHJ 85777783XH6c05xw9clVQ3+STMqu/Tv+9NqPZVXovl+8WzeS2Xu8eUXNi+YS9l17c85hQp/Fz abYJK7fEtnKzBdMvrUphYl+45dTJa6UmPl8n9thIKlgc4dIo468oS9EPnFI8cfuzR4vbOYR5K gp+d2R+lFNiKc5INNRiLipOBACeHsI5sQIAAA== X-Env-Sender: rcojocaru@bitdefender.com X-Msg-Ref: server-16.tower-21.messagelabs.com!1474460773!29853156!1 X-Originating-IP: [91.199.104.161] X-SpamReason: No, hits=0.9 required=7.0 tests=SUBJ_HAS_UNIQ_ID X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18211 invoked from network); 21 Sep 2016 12:26:14 -0000 Received: from mx01.bbu.dsd.mx.bitdefender.com (HELO mx01.bbu.dsd.mx.bitdefender.com) (91.199.104.161) by server-16.tower-21.messagelabs.com with DHE-RSA-AES128-GCM-SHA256 encrypted SMTP; 21 Sep 2016 12:26:14 -0000 Received: (qmail 20850 invoked from network); 21 Sep 2016 15:26:12 +0300 Received: from unknown (HELO mx-sr.buh.bitdefender.com) (10.17.80.103) by mx01.bbu.dsd.mx.bitdefender.com with AES256-GCM-SHA384 encrypted SMTP; 21 Sep 2016 15:26:12 +0300 Received: from smtp03.buh.bitdefender.org (smtp.bitdefender.biz [10.17.80.77]) by mx-sr.buh.bitdefender.com (Postfix) with ESMTP id CA4707FBFE for ; Wed, 21 Sep 2016 15:26:12 +0300 (EEST) Received: (qmail 4267 invoked from network); 21 Sep 2016 15:26:12 +0300 Received: from xen.dsd.ro (HELO xen.dsd.bitdefender.biz) (rcojocaru@bitdefender.com@10.10.14.109) by smtp03.buh.bitdefender.org with AES128-SHA256 encrypted SMTP; 21 Sep 2016 15:26:12 +0300 From: Razvan Cojocaru To: xen-devel@lists.xen.org Date: Wed, 21 Sep 2016 15:25:58 +0300 Message-Id: <1474460758-25367-1-git-send-email-rcojocaru@bitdefender.com> X-Mailer: git-send-email 1.9.1 X-BitDefender-Scanner: Clean, Agent: BitDefender qmail 3.1.6 on smtp03.buh.bitdefender.org, sigver: 7.67316 X-BitDefender-Spam: No (0) X-BitDefender-SpamStamp: Build: [Engines: 2.15.6.911, Dats: 433037, Stamp: 3], Multi: [Enabled, t: (0.000008, 0.001297)], BW: [Enabled, t: (0.000007,0.000001)], RBL DNSBL: [Disabled], APM: [Enabled, Score: 500, t: (0.002002), Flags: 85D2ED72; NN_NO_CONTENT_TYPE; NN_NO_LINK_NMD; NN_LEGIT_BITDEFENDER; NN_LEGIT_S_SQARE_BRACKETS; NN_LEGIT_MAILING_LIST_TO], SGN: [Enabled, t: (0.008018)], URL: [Enabled, t: (0.000005)], RTDA: [Enabled, t: (0.008596), Hit: No, Details: v2.3.11; Id: 2m1ghmj.1at660qkn.thj], total: 0(775) X-BitDefender-CF-Stamp: none Cc: george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, Razvan Cojocaru , jbeulich@suse.com Subject: [Xen-devel] [PATCH] x86/mm: Fix Coverity issues 1373105 and 1373106 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Added missing error checks in p2m_set_mem_access_multi(). Signed-off-by: Razvan Cojocaru --- xen/arch/x86/mm/p2m.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index b16e563..e850510 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1936,8 +1936,12 @@ long p2m_set_mem_access_multi(struct domain *d, uint8_t access; uint64_t gfn_l; - copy_from_guest_offset(&gfn_l, pfn_list, start, 1); - copy_from_guest_offset(&access, access_list, start, 1); + if ( copy_from_guest_offset(&gfn_l, pfn_list, start, 1) || + copy_from_guest_offset(&access, access_list, start, 1) ) + { + rc = -EINVAL; + break; + } if ( !xenmem_access_to_p2m_access(p2m, access, &a) ) {