Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1148460imm; Tue, 5 Jun 2018 09:47:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJrbCZkF6NvX35CTC96QtrsKIs1yhNDJfuRUOTTZ0gkxa6Sg9OwvVhSB3//0a03XgkV4Et2 X-Received: by 2002:a63:700e:: with SMTP id l14-v6mr10911973pgc.206.1528217250406; Tue, 05 Jun 2018 09:47:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528217250; cv=none; d=google.com; s=arc-20160816; b=AFK2W/3WAIdKnMH/Cv44AT0gAiWoJ61qgHG2IX/zGDJB9tiLUNrwj75L+GIyuY4aDX JjUAM0jk82BKUHWlYMWGzeBYUHY7ZYVH1/z7plzwNCSWAPweRWSqrD+axF6Np5d7sGJE YVwqhmKlKghN0d/00GtrOcf9WyilMjohTzy9TwS/lG5A0w6TnHcGEJkfHe9DV3d95IHu uW2vwvTaLAIMxf3zQmTB00+Uuv4R9VlkfM28Hd2Crc7/nE19D8DQnJ/QGfRL5LpL0K3n tVbRLbON8hgnplFZv0rk3oJjMGef7AjJG4hXfwbtFTz4hREl701wSPnzHDYWE5qtInv8 /U1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=2yswvGHrB6nb4DzVQvEFS06D26ZeXnHHUAvpmjV6kBg=; b=iNaihrgKHHGF7eJkz+ojOSmlgPlhUtEpXOX1/STYakaRPEjD2FBGly8MqnI8QLD7Wv CetueijGlmJ1PL//X2JRIbQs7Zi1NOP3l8zMrEHOZZznAWcyl2L5A0qONBy+70vDR7mE yWNAzZroEfjB8gcs3e3oROYboQrA/v5jHfHa5HLC5+xAxexBiRoNRQjDgXo5IvHOIp1L Qov3pG9z6hdG1KwHmJ+WG4MKuhCGiRJyKOJWGz9Z44Fjvx9ydA30/14szq/R1M1D3rBe rJF1T0mP/faUVktw3+lIifx58zc47hz+1bk6uEZaIXSWATDzsx034lFfVv/IO3+2OgTW EGrg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 134-v6si17643319pgd.80.2018.06.05.09.47.15; Tue, 05 Jun 2018 09:47:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752418AbeFEQpE (ORCPT + 99 others); Tue, 5 Jun 2018 12:45:04 -0400 Received: from mx2.suse.de ([195.135.220.15]:46866 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751950AbeFEQns (ORCPT ); Tue, 5 Jun 2018 12:43:48 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 95D16AD7C; Tue, 5 Jun 2018 16:43:46 +0000 (UTC) From: Michal Suchanek To: Jonathan Corbet , Michal Suchanek , Arnd Bergmann , Frederic Weisbecker , Ingo Molnar , Aaron Wu , Tony Luck , Andrew Morton , Thomas Gleixner , "Steven Rostedt," , Laura Abbott , Dominik Brodowski , Alexey Dobriyan , Tom Lendacky , Jeffrey Hugo , Baoquan He , Ilya Matveychikov , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 3/5] init/main.c: simplify repair_env_string. Date: Tue, 5 Jun 2018 18:43:10 +0200 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting characters are now removed from the parameter so value always follows directly after the NUL terminating parameter name. Signed-off-by: Michal Suchanek --- init/main.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/init/main.c b/init/main.c index 4bc2819d97ad..d0f4a7a0f010 100644 --- a/init/main.c +++ b/init/main.c @@ -251,15 +251,10 @@ static int __init repair_env_string(char *param, char *val, const char *unused, void *arg) { if (val) { - /* param=val or param="val"? */ - if (val == param+strlen(param)+1) - val[-1] = '='; - else if (val == param+strlen(param)+2) { - val[-2] = '='; - memmove(val-1, val, strlen(val)+1); - val--; - } else - BUG(); + int parm_len = strlen(param); + + param[parm_len] = '='; + BUG_ON(val != param + parm_len + 1); } return 0; } -- 2.13.6