From patchwork Wed Jan 30 01:23:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dexuan Cui X-Patchwork-Id: 10787467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2F9AF91E for ; Wed, 30 Jan 2019 01:23:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11DC72D151 for ; Wed, 30 Jan 2019 01:23:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F3A4C2D22B; Wed, 30 Jan 2019 01:23:15 +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=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DDC02D151 for ; Wed, 30 Jan 2019 01:23:14 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8E40921A00AE6; Tue, 29 Jan 2019 17:23:14 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.130.119; helo=apc01-hk2-obe.outbound.protection.outlook.com; envelope-from=decui@microsoft.com; receiver=linux-nvdimm@lists.01.org Received: from APC01-HK2-obe.outbound.protection.outlook.com (mail-eopbgr1300119.outbound.protection.outlook.com [40.107.130.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3EC31211B5A44 for ; Tue, 29 Jan 2019 17:23:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OIxYUViA6bkPS8XmvR9v9mRU+AeG9PslgO69bthaQPc=; b=WGtEB1ivGBb4Ee0UHnqMt/7D/tAe8sh3OV5k+HGjhe2x/bf1f+7wABpwGPGDz64I4pUAyJpdzzrcxPwUQ12JHbjnROKMIlWIdqnZVOVFmZoy2EG06gAs7CblI/5Nu39vOvXobcogQHxQzimBx8dXTCDZ7BFtiUd+rH7NW5n+uFU= Received: from PU1P153MB0169.APCP153.PROD.OUTLOOK.COM (10.170.189.13) by PU1P153MB0139.APCP153.PROD.OUTLOOK.COM (10.170.188.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1601.7; Wed, 30 Jan 2019 01:23:02 +0000 Received: from PU1P153MB0169.APCP153.PROD.OUTLOOK.COM ([fe80::7822:a20:e63c:de2f]) by PU1P153MB0169.APCP153.PROD.OUTLOOK.COM ([fe80::7822:a20:e63c:de2f%9]) with mapi id 15.20.1601.008; Wed, 30 Jan 2019 01:23:02 +0000 From: Dexuan Cui To: Dan Williams , Ross Zwisler , Vishal Verma , Dave Jiang , "Rafael J. Wysocki" , Len Brown , "linux-nvdimm@lists.01.org" , "linux-acpi@vger.kernel.org" Subject: [PATCH] nfit: acpi_nfit_ctl(): check out_obj->type in the right place Thread-Topic: [PATCH] nfit: acpi_nfit_ctl(): check out_obj->type in the right place Thread-Index: AdS4Oct5qHYRlzYATxKGX2lG5IAWXg== Date: Wed, 30 Jan 2019 01:23:01 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=decui@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2019-01-30T01:22:59.6825191Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=c4555d01-0583-4f01-9e5c-3168cb9c12f1; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic authentication-results: spf=none (sender IP is ) smtp.mailfrom=decui@microsoft.com; x-originating-ip: [2001:4898:80e8:7:3d8c:13fc:95ca:ce39] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; PU1P153MB0139; 6:hHOyL6CJxAoxEeDOTTol3TF8mKxY4EOwW94AXNhFc0SayM8rMzREklKL+7o8ntQhw11wkLd23hex3nXPpljAksNdYpOzLB3P5ZMzQ0fsXa21DD8MmOqQGMDP+BJp01E+Qk06ydTNOLpE9a1JXTJWn01FZNwJwyKnsLLwxRURz/1+c20rrfC285X83K0ym8NmFOSBxCBfR6rvhwVb8cv52btipfJehgu6E42GQI1xq0RxzXeBt+iX5/jrZznH+qql593pQHT7WCyPXW82yHLbTaBQ42148rdMztr0ZZS8R4hZ0hax6ND+I0XzC5qgaRlRHk9jk7ms+F8LJ/Mk3SHMoWUh0pYLc2cceauF6vbsv1mucXAhbgZlNi2VkGpBf5PDm/+79Ozts+GT+RQHygnCVPhSRRKwlaIdhvJsAVwggAXUO/Ia/UcHOAW4kYWx+A5QP0W7KQAYizNadGb5XkPCzA==; 5:oTbampaOTfC3EtYApvdZEuAkupL82M30O2VIqLR3S6iKOLdH2MmPYOgw3UF7mTsnC+w0+MKLKbqAPxzvMKi7pPBoNWBB8zQe3P8ki5VgGyEPSL4X/UFGMm5Makwi7UmW23UAv2QzxsDnotfT9aId8mX11En/QHHrtVY1DJZ7SlJlC1yxj8LAAKxlrs+kj+2z6VAjM+zdqbw9AIt9n60vIw==; 7:x1qYR2SSHr+JIRRaw9UNhIwDpf4dxCnKQtycaa/44WsnYpP3rkUqUEhXPvElOrN/H9AVYx4krjYjmh/9Zgb9t86sYMFGFpIIdvkvH0QYIrZHUk6golgEMAZz8bZLP95eEItQ/twxpG224bpTjt332Q== x-ms-office365-filtering-correlation-id: e74213d0-9a59-47b8-3ad1-08d686517a4f x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600110)(711020)(4605077)(4618075)(2017052603328)(7193020); SRVR:PU1P153MB0139; x-ms-traffictypediagnostic: PU1P153MB0139: x-ms-exchange-purlcount: -3 x-microsoft-antispam-prvs: x-forefront-prvs: 0933E9FD8D x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(979002)(39860400002)(376002)(366004)(136003)(346002)(396003)(199004)(189003)(71200400001)(305945005)(7696005)(186003)(33656002)(476003)(14454004)(486006)(81156014)(10290500003)(478600001)(25786009)(53936002)(2501003)(81166006)(68736007)(6116002)(6506007)(4326008)(8676002)(107886003)(110136005)(102836004)(9686003)(55016002)(105586002)(99286004)(106356001)(2201001)(2906002)(7416002)(8990500004)(54906003)(8936002)(316002)(74316002)(10090500001)(46003)(97736004)(256004)(22452003)(86612001)(86362001)(6436002)(7736002)(71190400001)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1102; SCL:1; SRVR:PU1P153MB0139; H:PU1P153MB0169.APCP153.PROD.OUTLOOK.COM; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: GhMBuwpeHc/K09CPgpatEec4//eww7tHJ/Ile7LueP89FMEA19x6bBV4u7j2ikA42x6nFEdZ8RlFz/dDOYsPF/x9hPvriFdy//ztKf86VNB6HdYvjLl9jVkl2KrpJLNckm0Q+sSr9tNv7DR5EZOj54z00pRfICuS0NBEsUvsV1/VTP7Bazj2mVp+jxTO7u0u35FYbtnBZQIWFdv7qF7vEVj8jCDvCwuCCmnZ2SR/WYPKKgNhSd8bCQ5/TUNFdP+u/tEzWXWacrvn/wlUYmoTPFfcBEZJprwCYmrr4n8w1ngnlYdcVP5J6IPjIfPuJ+eVaC3AhqFhTPHg+sqMvAEFPeeYuzDp/Di1uTfXTwQFv99mXjsZWOJun2K9eTtv//zrfVk14WT5zBapZNXqNxtbKcvHbiIFoTB7VKW5zQCnnTQ= MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: e74213d0-9a59-47b8-3ad1-08d686517a4f X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Jan 2019 01:23:01.8071 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-Transport-CrossTenantHeadersStamped: PU1P153MB0139 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Josh Poulson , Stephen Hemminger , Haiyang Zhang , "driverdev-devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , Michael Kelley , Sasha Levin , KY Srinivasan Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP In the case of ND_CMD_CALL, we should also check out_obj->type. The patch uses out_obj->type, which is a short alias to out_obj->package.type. Fixes: 31eca76ba2fc ("nfit, libnvdimm: limited/whitelisted dimm command marshaling mechanism") Cc: Signed-off-by: Dexuan Cui --- drivers/acpi/nfit/core.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 0a49c57334cc..1fa378435dd2 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -554,6 +554,13 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, return -EINVAL; } + if (out_obj->type != ACPI_TYPE_BUFFER) { + dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n", + dimm_name, cmd_name, out_obj->type); + rc = -EINVAL; + goto out; + } + if (call_pkg) { call_pkg->nd_fw_size = out_obj->buffer.length; memcpy(call_pkg->nd_payload + call_pkg->nd_size_in, @@ -572,13 +579,6 @@ int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, return 0; } - if (out_obj->package.type != ACPI_TYPE_BUFFER) { - dev_dbg(dev, "%s unexpected output object type cmd: %s type: %d\n", - dimm_name, cmd_name, out_obj->type); - rc = -EINVAL; - goto out; - } - dev_dbg(dev, "%s cmd: %s output length: %d\n", dimm_name, cmd_name, out_obj->buffer.length); print_hex_dump_debug(cmd_name, DUMP_PREFIX_OFFSET, 4, 4,