Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934523Ab3JPNvP (ORCPT ); Wed, 16 Oct 2013 09:51:15 -0400 Received: from arkanian.console-pimps.org ([212.110.184.194]:60923 "EHLO arkanian.console-pimps.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934095Ab3JPNvJ (ORCPT ); Wed, 16 Oct 2013 09:51:09 -0400 From: Matt Fleming To: linux-efi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Andi Kleen , Tony Luck , Seiji Aguchi , x86@kernel.org, Matt Fleming , Anton Vorontsov , Colin Cross , Kees Cook Subject: [PATCH 1/5] pstore/ftrace: Don't increment initial data offset Date: Wed, 16 Oct 2013 14:50:56 +0100 Message-Id: <1381931460-6999-2-git-send-email-matt@console-pimps.org> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1381931460-6999-1-git-send-email-matt@console-pimps.org> References: <1381931460-6999-1-git-send-email-matt@console-pimps.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1539 Lines: 45 From: Matt Fleming Delete the following expression, data->off = ps->size % REC_SIZE; as it is not reasonable to expect users to allocate an exact multiple of REC_SIZE because that constant isn't exported outside of fs/pstore. There are already checks in the ftrace code to ensure that no accesses happen beyond the bounds of the buffer, so there's no real reason to skip the beginning of the data buffer. It's likely this hasn't been caught before because this code mainly runs under ARM where REC_SIZE is 8 bytes. On x86-64 REC_SIZE is 24 bytes and so it's more likely that ps->size isn't going to be a multiple. Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Tony Luck Signed-off-by: Matt Fleming --- fs/pstore/inode.c | 1 - 1 file changed, 1 deletion(-) diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index 71bf5f4..cc6ec0e 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c @@ -71,7 +71,6 @@ static void *pstore_ftrace_seq_start(struct seq_file *s, loff_t *pos) if (!data) return NULL; - data->off = ps->size % REC_SIZE; data->off += *pos * REC_SIZE; if (data->off + REC_SIZE > ps->size) { kfree(data); -- 1.8.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/