From patchwork Tue Jul 4 13:55:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Steffen X-Patchwork-Id: 784000 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x25RQ4YnKz9t1t for ; Wed, 5 Jul 2017 00:07:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sourceforge.net header.i=@sourceforge.net header.b="WogolY7p"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sf.net header.i=@sf.net header.b="CSO5Py3h"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=infineon.com header.i=@infineon.com header.b="In543CXe"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dSOTr-0001Xw-7g; Tue, 04 Jul 2017 14:07:07 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dSOTq-0001Xp-2L for tpmdd-devel@lists.sourceforge.net; Tue, 04 Jul 2017 14:07:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=1BNuB+jg+QrBcmxz+QtD/bs+YTXDqlv55gNuiytRyBs=; b=WogolY7pkpRSJ+Fy52yjJWtjDr/eGSF+5/Yek9c06e4FluYT8uQ35WwMJPJKIg5KWAjQq4P2Aqmrk7YIw/1FIotO3oq6n1wqHpwTKn8nbHL7pIStEQwxtiSIY/j9Diz4iKbQPZ23RAphUhfHFHrxDxBwCDYk7HOpoBCY2kgks0I=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x; h=Content-Type:MIME-Version:Message-ID:Date:Subject:CC:To:From; bh=1BNuB+jg+QrBcmxz+QtD/bs+YTXDqlv55gNuiytRyBs=; b=CSO5Py3hvFC1545jvC+/+tBt15Y0OMIpiiTMfuFt3G9zBYqJkNGypTY81vquagAyypVIjWy54Ke9LhOe+4w0tw3IsJgk6TKcaAKEqfqansBoEs+IGviWbZrymNWi6jUwH2zgT2NPiwwZX4Xp2tuRZrqmTE4ynfMRXKAV75YSYA8=; Received-SPF: pass (sog-mx-1.v43.ch3.sourceforge.com: domain of infineon.com designates 217.10.52.18 as permitted sender) client-ip=217.10.52.18; envelope-from=alexander.steffen@infineon.com; helo=smtp2.infineon.com; Received: from smtp2.infineon.com ([217.10.52.18]) by sog-mx-1.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1dSOTp-0002VP-66 for tpmdd-devel@lists.sourceforge.net; Tue, 04 Jul 2017 14:07:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1499177225; x=1530713225; h=from:to:cc:subject:date:message-id:mime-version; bh=C2+Ov3WVJ4/xC0UDBHkCAaxaFIrya5efZhus4H5JA18=; b=In543CXeQwQxA1RumixLnr4BjqNdiiCbNWyjFQWXrT3jTIq+3556Wkmu 5QwbEqOFlTVgcy7Xh6nJrVq9SMY1KaIWldVOJiUaQMOboCRVR/h/wntfc d5R2nwU2zjiRQ+Ho4xZFiItGHmluyFQ2dGr3Zl36du5dpRL5P3Lmnwpq6 Y=; X-SBRS: None Received: from unknown (HELO mucxv002.muc.infineon.com) ([172.23.11.17]) by smtp2.infineon.com with ESMTP/TLS/AES256-GCM-SHA384; 04 Jul 2017 15:55:34 +0200 Received: from MUCSE606.infineon.com (unknown [172.23.7.107]) by mucxv002.muc.infineon.com (Postfix) with ESMTPS for ; Tue, 4 Jul 2017 15:55:34 +0200 (CEST) Received: from MUCSE603.infineon.com (172.23.7.104) by MUCSE606.infineon.com (172.23.7.107) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 4 Jul 2017 15:55:33 +0200 Received: from ABGN5CG4522MQD.eu.infineon.com (172.29.170.97) by MUCSE603.infineon.com (172.23.7.104) with Microsoft SMTP Server (TLS) id 15.0.1263.5; Tue, 4 Jul 2017 15:55:33 +0200 From: Alexander Steffen To: Date: Tue, 4 Jul 2017 15:55:21 +0200 Message-ID: <20170704135521.9696-1-Alexander.Steffen@infineon.com> X-Mailer: git-send-email 2.11.1.windows.1 MIME-Version: 1.0 X-Originating-IP: [172.29.170.97] X-ClientProxiedBy: MUCSE601.infineon.com (172.23.7.102) To MUCSE603.infineon.com (172.23.7.104) X-Spam-Score: -1.6 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-Headers-End: 1dSOTp-0002VP-66 Subject: [tpmdd-devel] [PATCH] tpm-dev-common: Use sizeof instead of constant X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: tpmdd-devel-bounces@lists.sourceforge.net This avoids accidentially changing the structure definition, without adopting this size check. Signed-off-by: Alexander Steffen --- drivers/char/tpm/tpm-dev-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/tpm/tpm-dev-common.c b/drivers/char/tpm/tpm-dev-common.c index 610638a..192740e 100644 --- a/drivers/char/tpm/tpm-dev-common.c +++ b/drivers/char/tpm/tpm-dev-common.c @@ -99,7 +99,7 @@ ssize_t tpm_common_write(struct file *file, const char __user *buf, if (atomic_read(&priv->data_pending) != 0) return -EBUSY; - if (in_size > TPM_BUFSIZE) + if (in_size > sizeof(priv->data_buffer)) return -E2BIG; mutex_lock(&priv->buffer_mutex);