From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8A665C38142 for ; Wed, 1 Feb 2023 08:39:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2E23D85C28; Wed, 1 Feb 2023 09:39:49 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=baylibre-com.20210112.gappssmtp.com header.i=@baylibre-com.20210112.gappssmtp.com header.b="hgHSRG5d"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8B66185C2A; Wed, 1 Feb 2023 09:39:47 +0100 (CET) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D0DA885C1B for ; Wed, 1 Feb 2023 09:39:44 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=baylibre.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mkorpershoek@baylibre.com Received: by mail-wr1-x435.google.com with SMTP id h16so16493053wrz.12 for ; Wed, 01 Feb 2023 00:39:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=5LX7+rZU7lLkMeyGykH15qbhY9u7U7uqrPy3VIXWPCE=; b=hgHSRG5dBty4eQ8RoXbNArl2pQo1ax4QQoWvzosACaFjYJdyX6lhyHqBbQt9QVY5qi qtBcP5guNO2IXec4t6FjOIUwGLv/a3WiMxMFaj4UAjo1x/hI3zjJPzPjauRlXXFDpSkj 7yeyeB4lKbcIUL+v9Ep1zL+zIG/CV+y4KstJtuZgOW/0YyQ/MHeGSkqfaUcevLBXeTsi v4Ye9iVBR6hKLMfS87lft79OHnOTnHh1ycHdCRRwVNRE6/LdhwFZSP1yBZpFES4Vtq6B tlHOC8J//Nu5vr8yVp5K7QwVAC3hzBxCsxHaGHasXh9Xge5iad6KPjdTNkAn1Cd/jw5w 6bcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5LX7+rZU7lLkMeyGykH15qbhY9u7U7uqrPy3VIXWPCE=; b=Cpqc5/t2C9rM8LrgoYzockqYe8CF2DiC7u4cUBerPYJzYq2JOaa9GEjLzOvk127eTm PEaOGgMunUhV2NbOBgM5btLPi6pBUn89mOfZ3huw9JwRaZ6nvB1mONmGYGY64qWJKxYV hQUd6thFWuU4FgqwfVYlW7P852OJhqr0HPYpMyMFQAfrRd/9KUlhJaq4RPfgKqmLTEAz dhjmmgRReaHgBcrjeeAo5wtTwmCh/9XmiI8/sRaxCifFbGXWxwHg9HaTf1uOCgSZsn// PGDuG34Jq/HnC33GW0vtYtF3NLEy2LSiCd1PzqQE5AYV01I/rMXsQX6LyA3hEk8t2jaA RP2w== X-Gm-Message-State: AO0yUKXjtHP6yZXE+vEWCz3/cbhyJL6AC2l5sg1PiAhdQSoplCXh9F5w nZ08Uwya222cwNMW3UZm/jKuQA== X-Google-Smtp-Source: AK7set8dWVRJKah8nxxxiryBWbavU+Mg+VahW/ME1VGGDpZXNOyhet/ugV7mX6oxmG/mZ37ruif7Zg== X-Received: by 2002:adf:e750:0:b0:2bf:c21f:329e with SMTP id c16-20020adfe750000000b002bfc21f329emr5548606wrn.3.1675240784319; Wed, 01 Feb 2023 00:39:44 -0800 (PST) Received: from localhost ([82.66.159.240]) by smtp.gmail.com with ESMTPSA id g8-20020adfe408000000b002bdda9856b5sm16959951wrm.50.2023.02.01.00.39.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Feb 2023 00:39:44 -0800 (PST) From: Mattijs Korpershoek To: Simon Glass , Safae Ouajih Cc: u-boot@lists.denx.de, sean.anderson@seco.com, r.stratiienko@gmail.com, glaroque@baylibre.com, khilman@baylibre.com Subject: Re: [PATCH v2 12/17] android: boot: support extra command line In-Reply-To: References: <20230126160506.1026643-1-souajih@baylibre.com> <20230126160506.1026643-13-souajih@baylibre.com> <0815983a-f4c8-578b-7619-027f5753c7d9@baylibre.com> Date: Wed, 01 Feb 2023 09:39:42 +0100 Message-ID: <87o7qdixtd.fsf@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean On Fri, Jan 27, 2023 at 10:15, Simon Glass wrote: > On Fri, 27 Jan 2023 at 08:51, Safae Ouajih wrote: >> >> >> On 27/01/2023 01:54, Simon Glass wrote: >> > Hi Safae, >> > >> > On Thu, 26 Jan 2023 at 09:05, Safae Ouajih wrote: >> >> In version 3 and 4 of boot image header, the vendor specific >> > vendor-spefcific >> > >> >> command line are located in vendor boot image. Thus, using >> > use the >> > >> >> extra command line to add those cmd to bootargs. >> >> >> >> Signed-off-by: Safae Ouajih Reviewed-by: Mattijs Korpershoek >> >> --- >> >> boot/image-android.c | 11 +++++++++++ >> >> 1 file changed, 11 insertions(+) >> >> >> >> diff --git a/boot/image-android.c b/boot/image-android.c >> >> index 5b270e4417..cb4fc22b00 100644 >> >> --- a/boot/image-android.c >> >> +++ b/boot/image-android.c >> >> @@ -55,6 +55,7 @@ static void android_vendor_boot_image_v3_v4_parse_hdr(const struct andr_vendor_i >> >> * The header takes a full page, the remaining components are aligned >> >> * on page boundary. >> >> */ >> >> + data->kcmdline_extra = hdr->cmdline; >> >> data->tags_addr = hdr->tags_addr; >> >> data->image_name = hdr->name; >> >> data->kernel_addr = hdr->kernel_addr; >> >> @@ -233,6 +234,11 @@ int android_image_get_kernel(const struct andr_boot_img_hdr_v0 *hdr, >> >> len += strlen(img_data.kcmdline); >> >> } >> >> >> >> + if (img_data.kcmdline_extra) { >> >> + printf("Kernel extra command line: %s\n", img_data.kcmdline_extra); >> >> + len += strlen(img_data.kcmdline_extra); >> >> + } >> >> + >> >> char *bootargs = env_get("bootargs"); >> >> if (bootargs) >> >> len += strlen(bootargs); >> >> @@ -252,6 +258,11 @@ int android_image_get_kernel(const struct andr_boot_img_hdr_v0 *hdr, >> >> if (*img_data.kcmdline) >> >> strcat(newbootargs, img_data.kcmdline); >> >> >> >> + if (img_data.kcmdline_extra) { >> >> + strcat(newbootargs, " "); >> >> + strcat(newbootargs, img_data.kcmdline_extra); >> > Do we need to worry about overflow? >> >> Hi Simon, >> >> This line adds kcmdline_extra length to the len variable: >> >> len += strlen(img_data.kcmdline_extra); >> >> newbootargs is allocated just after in : >> >> char *newbootargs = malloc(len + 2); >> >> I can not see a possible overflow, please let me know if you >> >> think this is not enough. > > OK I see, thank you. > > Reviewed-by: Simon Glass