From nobody Thu Nov 28 17:51:05 2024 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2002C192D78; Mon, 30 Sep 2024 13:12:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727701956; cv=none; b=YgylIqVmaa49Log0DoNdyHo1KqWRxvdU5t6kU6Ncq7axVtACPnFCVpEIAX6JTHhsXday2Hm1HVAFyPF5T2RmHMH7sG/ZJFPAfVUrsvL3c9zfHR6Cg/Q+Uit7YUEl/Rm01jaSy2MKUIQzE0/NilBwYRbotZR2zrK9RbepYknzF0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727701956; c=relaxed/simple; bh=zTNAMyL/JzNpPNPijEGwC0EtChrujzdvS8Qk2cIGDy8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=jb9ETFtRnqfcg3iyGCnzVnwXEuq+9rv39TH1ejXDhrQ/ySW3AdJTmCWDmS+Yt/I+C003zOpKrGa/23mtYDPd8b5vjAiXkT+KO2zByyGI5hqjLN5l+VH6mTX9TfjlxnqU2tl8jvI8dp8DdW8JCu/zKSOfAwe8Dh88osHfcZE7QIs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-a8d2daa2262so502034766b.1; Mon, 30 Sep 2024 06:12:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727701953; x=1728306753; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dte1BRYAJLLwHh4pCmZC5hBkzqPqK7pt5D4K6M9ka5Q=; b=vrFiQKadhvQiqsACDK2fZvCsA36CRYG2U/Q2ztfzSRah9iSkptIUOJLQATvf51YjHd iPiQO7UpfGZ50KJ2Mf8QdO8OnnZiNCq75nt2zA5ZTJzdPOcD+mwsBVnDywUUbgf2Bkhh afFvj+6U1ODjQX8ni+txoFlqXISTy7NSkVTUJB3gy/Y2jKJR5tOfyEqiD/0g/b6WKCwB eaAsnic+/PqLxTgG4tdcQ8es86bNrmtJPDhvodVcBUNoeS6O2hCCR0p4oSn7MOlZ5rJ1 jbamLnr4pCyHibPKhg1BrEENNWv6QKtQ/v0ZVHC/SDGcP+IoTwospUzrifMQVJ/jx7bN tgSw== X-Forwarded-Encrypted: i=1; AJvYcCVhvOHgvYeaDQbnWbQj/6mRs7WDkg14LULznQD4J1VtkH62gHsCiYqrW0a6l87ZVYUPn6e6XwE8@vger.kernel.org, AJvYcCWfqhbsAD/vgmtRoQLbI3iaMmZGQyUm5163UfNHu9vbUnuzOQlqQ3HjgEXvAH6l9BxTQpZ2LPFb0gMB2uk=@vger.kernel.org X-Gm-Message-State: AOJu0YzyPG8HsMuNRdBqAoLf9YBfR4CJ0Xijarg0DQ56ibxyIO+IEdzS 4uRQgYdKZjzpbWYEAO/6SsFWmWHnv3JwlOeNJzG847mIQNDyI2xd X-Google-Smtp-Source: AGHT+IEq864tMU2SjR00rmH1keO1clY+YuKZKzgBFgINNUYt69nIF1XuF2EdW6Dk7iR25RMGfgqr7Q== X-Received: by 2002:a17:907:eac:b0:a86:7199:af37 with SMTP id a640c23a62f3a-a93c4aca8d9mr1494540166b.58.1727701953384; Mon, 30 Sep 2024 06:12:33 -0700 (PDT) Received: from localhost (fwdproxy-lla-116.fbsv.net. [2a03:2880:30ff:74::face:b00c]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a93c299e5desm531297566b.223.2024.09.30.06.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Sep 2024 06:12:32 -0700 (PDT) From: Breno Leitao To: kuba@kernel.org, davem@davemloft.net, edumazet@google.com, pabeni@redhat.com Cc: thepacketgeek@gmail.com, horms@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, davej@codemonkey.org.uk, max@kutsevol.com Subject: [PATCH net-next v4 08/10] net: netconsole: do not pass userdata up to the tail Date: Mon, 30 Sep 2024 06:12:07 -0700 Message-ID: <20240930131214.3771313-9-leitao@debian.org> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20240930131214.3771313-1-leitao@debian.org> References: <20240930131214.3771313-1-leitao@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Do not pass userdata to send_msg_fragmented, since we can get it later. This will be more useful in the next patch, where send_msg_fragmented() will be split even more, and userdata is only necessary in the last function. Suggested-by: Simon Horman Signed-off-by: Breno Leitao Reviewed-by: Simon Horman --- drivers/net/netconsole.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 4a20bcab0b02..7266d4232d5d 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -1060,13 +1060,17 @@ static struct notifier_block netconsole_netdev_noti= fier =3D { =20 static void send_msg_no_fragmentation(struct netconsole_target *nt, const char *msg, - const char *userdata, int msg_len, int release_len) { static char buf[MAX_PRINT_CHUNK]; /* protected by target_list_lock */ + const char *userdata =3D NULL; const char *release; =20 +#ifdef CONFIG_NETCONSOLE_DYNAMIC + userdata =3D nt->userdata_complete; +#endif + if (release_len) { release =3D init_utsname()->release; =20 @@ -1094,7 +1098,6 @@ static void append_release(char *buf) =20 static void send_msg_fragmented(struct netconsole_target *nt, const char *msg, - const char *userdata, int msg_len, int release_len) { @@ -1102,10 +1105,11 @@ static void send_msg_fragmented(struct netconsole_t= arget *nt, static char buf[MAX_PRINT_CHUNK]; /* protected by target_list_lock */ int offset =3D 0, userdata_len =3D 0; const char *header, *msgbody; + const char *userdata =3D NULL; =20 #ifdef CONFIG_NETCONSOLE_DYNAMIC - if (userdata) - userdata_len =3D nt->userdata_length; + userdata =3D nt->userdata_complete; + userdata_len =3D nt->userdata_length; #endif =20 /* need to insert extra header fields, detect header and msgbody */ @@ -1202,12 +1206,10 @@ static void send_msg_fragmented(struct netconsole_t= arget *nt, static void send_ext_msg_udp(struct netconsole_target *nt, const char *msg, int msg_len) { - char *userdata =3D NULL; int userdata_len =3D 0; int release_len =3D 0; =20 #ifdef CONFIG_NETCONSOLE_DYNAMIC - userdata =3D nt->userdata_complete; userdata_len =3D nt->userdata_length; #endif =20 @@ -1215,10 +1217,9 @@ static void send_ext_msg_udp(struct netconsole_targe= t *nt, const char *msg, release_len =3D strlen(init_utsname()->release) + 1; =20 if (msg_len + release_len + userdata_len <=3D MAX_PRINT_CHUNK) - return send_msg_no_fragmentation(nt, msg, userdata, msg_len, - release_len); + return send_msg_no_fragmentation(nt, msg, msg_len, release_len); =20 - return send_msg_fragmented(nt, msg, userdata, msg_len, release_len); + return send_msg_fragmented(nt, msg, msg_len, release_len); } =20 static void write_ext_msg(struct console *con, const char *msg, --=20 2.43.5