From: David Howells Subject: Re: [PATCH v1.5 3/5] key: add tpm_send command Date: Tue, 30 Nov 2010 14:32:00 +0000 Message-ID: <19268.1291127520@redhat.com> References: <20101124023238.GA26540@tiny> <1290552635-3356-1-git-send-email-zohar@linux.vnet.ibm.com> <1290556456.2604.14.camel@localhost.localdomain> Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, keyrings@linux-nfs.org, linux-crypto@vger.kernel.org, Jason Gunthorpe , James Morris , David Safford , Rajiv Andrade To: kjhall@us.ibm.com, Serge Hallyn , Mimi Zohar , tpmdd-devel@lists.sourceforge.net Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46783 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752094Ab0K3Oc0 (ORCPT ); Tue, 30 Nov 2010 09:32:26 -0500 In-Reply-To: <20101124023238.GA26540@tiny> Sender: linux-crypto-owner@vger.kernel.org List-ID: Serge Hallyn wrote: > > +int tpm_send(u32 chip_num, void *cmd, size_t buflen) > > Hate to nit-pick, but any particular reason you're not following the > rest of the file and using 'struct tpm_cmd_t *cmd' here? Ummm... Something else I've just noticed... static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, size_t bufsiz) would suggest that buf is read-only, but tpm_transit() keeps casting it away, and especially, casts it away before passing it to chip->vendor.recv()... This would seem to indicate a logic error somewhere. Certainly, tpm_atml_recv() modifies the buffer it is given to... I suspect the argument and reply buffer pointers should be passed separately. David