From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424372AbcFHJx7 (ORCPT ); Wed, 8 Jun 2016 05:53:59 -0400 Received: from terminus.zytor.com ([198.137.202.10]:56242 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1423076AbcFHJxz (ORCPT ); Wed, 8 Jun 2016 05:53:55 -0400 Date: Wed, 8 Jun 2016 02:52:52 -0700 From: tip-bot for Borislav Petkov Message-ID: Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, brgerst@gmail.com, peterz@infradead.org, mingo@kernel.org, torvalds@linux-foundation.org, bp@suse.de, bp@alien8.de, dvlasenk@redhat.com, tglx@linutronix.de, luto@amacapital.net Reply-To: linux-kernel@vger.kernel.org, brgerst@gmail.com, hpa@zytor.com, torvalds@linux-foundation.org, mingo@kernel.org, bp@suse.de, peterz@infradead.org, bp@alien8.de, dvlasenk@redhat.com, luto@amacapital.net, tglx@linutronix.de In-Reply-To: <1465225850-7352-4-git-send-email-bp@alien8.de> References: <1465225850-7352-4-git-send-email-bp@alien8.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/microcode] lib/cpio: Make find_cpio_data()'s offset arg optional Git-Commit-ID: 7557933e6b99d381c19b196901ed537b00f6d121 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 7557933e6b99d381c19b196901ed537b00f6d121 Gitweb: http://git.kernel.org/tip/7557933e6b99d381c19b196901ed537b00f6d121 Author: Borislav Petkov AuthorDate: Mon, 6 Jun 2016 17:10:44 +0200 Committer: Ingo Molnar CommitDate: Wed, 8 Jun 2016 11:04:19 +0200 lib/cpio: Make find_cpio_data()'s offset arg optional Some callers don't use it so make it optional. Signed-off-by: Borislav Petkov Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Link: http://lkml.kernel.org/r/1465225850-7352-4-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar --- lib/earlycpio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/earlycpio.c b/lib/earlycpio.c index 3eb3e47..db283ba 100644 --- a/lib/earlycpio.c +++ b/lib/earlycpio.c @@ -125,7 +125,10 @@ struct cpio_data find_cpio_data(const char *path, void *data, if ((ch[C_MODE] & 0170000) == 0100000 && ch[C_NAMESIZE] >= mypathsize && !memcmp(p, path, mypathsize)) { - *nextoff = (long)nptr - (long)data; + + if (nextoff) + *nextoff = (long)nptr - (long)data; + if (ch[C_NAMESIZE] - mypathsize >= MAX_CPIO_FILE_NAME) { pr_warn( "File %s exceeding MAX_CPIO_FILE_NAME [%d]\n",