From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752426AbcFFPK6 (ORCPT ); Mon, 6 Jun 2016 11:10:58 -0400 Received: from mail.skyhub.de ([78.46.96.112]:57882 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751101AbcFFPKy (ORCPT ); Mon, 6 Jun 2016 11:10:54 -0400 From: Borislav Petkov To: X86 ML Cc: LKML Subject: [PATCH 3/9] lib/cpio: Make find_cpio_data()'s offset arg optional Date: Mon, 6 Jun 2016 17:10:44 +0200 Message-Id: <1465225850-7352-4-git-send-email-bp@alien8.de> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1465225850-7352-1-git-send-email-bp@alien8.de> References: <1465225850-7352-1-git-send-email-bp@alien8.de> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Some callers don't use it so make it optional. Signed-off-by: Borislav Petkov --- lib/earlycpio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/earlycpio.c b/lib/earlycpio.c index 3eb3e4722b8e..db283ba4d2c1 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", -- 2.7.3