From patchwork Thu Jun 15 17:46:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Greer X-Patchwork-Id: 9789473 X-Patchwork-Delegate: sameo@linux.intel.com 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 F2F3860231 for ; Thu, 15 Jun 2017 17:46:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E774D2862C for ; Thu, 15 Jun 2017 17:46:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DC5B328662; Thu, 15 Jun 2017 17:46:33 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C2C2862C for ; Thu, 15 Jun 2017 17:46:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751972AbdFORqX (ORCPT ); Thu, 15 Jun 2017 13:46:23 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:37959 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751644AbdFORqW (ORCPT ); Thu, 15 Jun 2017 13:46:22 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 74C6F207F0; Thu, 15 Jun 2017 13:46:21 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 15 Jun 2017 13:46:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=animalcreek.com; h=cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=ozt +7WIwD7z+laXaqVfhojfWfzf0r52ePf7y+C+O1Uc=; b=B+20kPOS709ELU7C1hs FkqOKxN27AC0evGMA5372md69XFRlEtKL99iBakTMpw473On9FVHb9RjGE06WEoc lkCtxHfGl8f58KVqF3GkNDrlFI656xuPXYOIBsEx2qB7hWdw7QE2/11vkfv9ibN7 y+DLH++E9jsrAmlbxGF8GKls= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=ozt+7WIwD7z+laXaqVfhojfWfzf0r52ePf7y+C+O1 Uc=; b=BHWcgaj4fLFx2otwSLpDDnsFMU9KXS4t1xnYnLtvLt7n0p/pV77Ve3h+Y liuOM0pYO8DcbRTJQotW3BKdE9Ey5MBHBGp9PFfWeNIzAzxZiOOVl0JhDNxF3fbS wYJB5rt1EhkLRbjEPF0HXjCFUW3HrJnvkVbRsPbjbFf8Nd3UdCLsx5R+w64Zl52A dHTSmi2e/W5ylZwgUSdJd/0Qxu+A56o0tQ586uha+jaBX/EEhn+slpTu5rukKTnp crmaV7/f5T98GzHSrM8MUqTMH1efU1ptT6sot/ayVkd0qJohpJi/DyJlVjqjfMWR b2Q6N+PZugwjB7LgjrL8jGdUfKZvg== X-ME-Sender: X-Sasl-enc: SEUcQCQpGcUQYqB31N404t8v2ZQ3JsHCwHCsA53zbxXL 1497548781 Received: from blue.animalcreek.com (ip68-2-81-12.ph.ph.cox.net [68.2.81.12]) by mail.messagingengine.com (Postfix) with ESMTPA id 359637E993; Thu, 15 Jun 2017 13:46:21 -0400 (EDT) Received: from blue.animalcreek.com (localhost [127.0.0.1]) by blue.animalcreek.com (Postfix) with ESMTP id 7EF78A20280; Thu, 15 Jun 2017 10:46:20 -0700 (MST) From: Mark Greer To: Samuel Ortiz Cc: linux-wireless@vger.kernel.org, linux-nfc@lists.01.org, Mark Greer Subject: [PATCH 1/3] NFC: digital: NFC-A SEL_RES must be one byte Date: Thu, 15 Jun 2017 10:46:15 -0700 Message-Id: <20170615174617.1817-2-mgreer@animalcreek.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170615174617.1817-1-mgreer@animalcreek.com> References: <20170615174617.1817-1-mgreer@animalcreek.com> Organization: Animal Creek Technologies, Inc. Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Section 4.8.2 (SEL_RES Response) of NFC Forum's NFC Digital Protocol Technical Specification dated 2010-11-17 clearly states that the size of a SEL_RES Response is one byte. Enforce this restriction in the code. Signed-off-by: Mark Greer --- net/nfc/digital_technology.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c index d9080dec5d27..06c4795ed647 100644 --- a/net/nfc/digital_technology.c +++ b/net/nfc/digital_technology.c @@ -27,6 +27,7 @@ #define DIGITAL_SDD_RES_CT 0x88 #define DIGITAL_SDD_RES_LEN 5 +#define DIGITAL_SEL_RES_LEN 1 #define DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res) (!((sel_res) & 0x04)) #define DIGITAL_SEL_RES_IS_T2T(sel_res) (!((sel_res) & 0x60)) @@ -299,7 +300,7 @@ static void digital_in_recv_sel_res(struct nfc_digital_dev *ddev, void *arg, } } - if (!resp->len) { + if (resp->len != DIGITAL_SEL_RES_LEN) { rc = -EIO; goto exit; }