From patchwork Sat Dec 30 20:08:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Markus Elfring X-Patchwork-Id: 13507044 X-Patchwork-Delegate: bpf@iogearbox.net Received: from mout.web.de (mout.web.de [212.227.15.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D781CBE5D; Sat, 30 Dec 2023 20:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=web.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=web.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=web.de header.i=markus.elfring@web.de header.b="t9apMdl9" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=s29768273; t=1703966896; x=1704571696; i=markus.elfring@web.de; bh=rAdygzKsqo2awjxq9Z7K0OqKNlPxCRegPbkMKgPEzqA=; h=X-UI-Sender-Class:Date:Subject:From:To:Cc:References: In-Reply-To; b=t9apMdl9JHUgfJkl67EqSzX4k1VZQa4CSAeNzR14gTH2CKJBT0LBvm/Cv4ehVUaF rznikftrvSK3bYtsk/87aOgV7KmN6aW2L+fuBVyi9oj9sFpcBjQaDQUVz21/0P4Ci nZvcT/CdWkfS6O7w0xx5ELH/NiALWkeUtminTScIMRNjUWYIaR9+0A0O97pTRuXTi eGM99TEg0A4/tbZnUHfXTLumoIUzasWfVuoO/OkLCHsWNp+O/IpyeCjbFAcS9dLe7 Ot0tX2euN1YAWtndcN5Nj/OzNtarfODNsVQGi8Q+w98KqXoNu/f9dBwFP11JaMu3P owbuV95QnS+YRWWy8Q== X-UI-Sender-Class: 814a7b36-bfc1-4dae-8640-3722d8ec6cd6 Received: from [192.168.178.21] ([94.31.87.95]) by smtp.web.de (mrweb005 [213.165.67.108]) with ESMTPSA (Nemesis) id 1MTfon-1rnXNV2aKL-00TvHq; Sat, 30 Dec 2023 21:08:16 +0100 Message-ID: Date: Sat, 30 Dec 2023 21:08:15 +0100 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: =?utf-8?q?=5BPATCH_2/5=5D_bpf=3A_Move_an_assignment_for_the_variabl?= =?utf-8?q?e_=E2=80=9Cst=5Fmap=E2=80=9D_in_bpf=5Fstruct=5Fops=5Flink=5Fcreat?= =?utf-8?q?e=28=29?= Content-Language: en-GB From: Markus Elfring To: bpf@vger.kernel.org, netdev@vger.kernel.org, kernel-janitors@vger.kernel.org, Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Hao Luo , Jiri Olsa , John Fastabend , KP Singh , Martin KaFai Lau , Song Liu , Stanislav Fomichev , Yonghong Song Cc: LKML References: <7011cdcc-4287-4e63-8bfa-f08710f670b1@web.de> In-Reply-To: <7011cdcc-4287-4e63-8bfa-f08710f670b1@web.de> X-Provags-ID: V03:K1:18qx8X9R9dIRWlO2/jLbUn6fKchkG9q9s5s9lZu63vS38Eo/5ev RnmbniKYVw/tMozG3vCSqLSGPjlaFDksCSEyEFK8nKfoIyBun8gZQBBNtpgbPJr6Wp3YViV n/AltZPgSrTzW3zwsNWLIEZy7Th93dxW2YnmsPbqFlw5ZWVV0+0eiGedZ7RXxjpv4Mrceyq dIy6B/+jmbxElD6HkJX8Q== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:i0un/BHbWps=;QKSAScUuoXyGC47nAxt4n0/zVM5 wpBfYIQsN/kjWMzBtX+Ek+R15mw4eH8Lzju2aQ+ejfnuZqNMDZxPuc2RqwZe4Ov7cNb6WuQ2c Lu+Eogw6bSRQABNBrv/RkXVWtZTtPcXQEOmyn6SM8UK9qorbPJZ0CMw0ILegPwkhLq6tK/1pz mNCjRqv/aHhpWXzFiQYzf8hRjWxlQNpy7CnfG3fT+PTmN/tzyrb31W5TZ/4yHgMJhmB4oavlA 2lNArTKwkfmfO0mGBeOj9XPi/8ApRYC2Z+9Qc/K5XG2xzxueKU5MSFq8M6fyfJaaUmSANJUXW R9t0qlVB/g+vAOrSok7rv7r94FAO26vrQttz53agoQW9vN3tK9Gk55cq3CKtvn2J7iSQi+YPN cLEoc7+t0Z9ZTcHE0nNwmcshOthzEq2Bt5PhABxjSV532O8yZO8EKxEymAHrAipbPVcCRFQZJ JpmUD2PnpI/RRQpDCORvCrepVECBSfT1gQhWGS0JaCAOEDlUpYb6ziYJj6E3hryx048Swz9Aj 5T8vAb3BZGuxCN3QQrVw4TaZWc+6IWmdpJjF8iTqFIlNE2vCScb0KF2hYSU8ygNFL5SleIGx6 008CdapbEA8tjCiJ/sF9xZWNB0JrMUgVM5l61wtOmEJi2UB/z7gSGRo48pSqVk6i47ccjnPxX i6iPqRaExLPU7R0RDS5K0ZKr8pLfAvAOtyjPlSPZDl1VjRAn6mlWSlfDMT2kBFgke5vOVvlYP JizTrINS7kElSNl/6eP+6g84nLKTTqjyLJ8tLXOvxR9d6TRhD5e9Wthjou87KkCLoq778nad/ ZofMjzuEBHro5p/JLiDA3e8fU7LOsmLy/FIyNE5nHVX293+trIAyFfG0wphkn5EO+8nkhAH25 xG6OmtE5mWbO9Nq9ZVO9pDLHjST4b1XPiJUqZvj65ThGwj7s69i8Yq62BsUyrHZkeC2FuIXmN x5010zC6Cb/rzRRyGeL71QRvjZ8= From: Markus Elfring Date: Sat, 30 Dec 2023 19:00:12 +0100 Move one assignment for the variable “st_map” closer to the place where this pointer is used. Signed-off-by: Markus Elfring --- kernel/bpf/bpf_struct_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.43.0 diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index b49ea460d616..4133d65c2a28 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -898,8 +898,6 @@ int bpf_struct_ops_link_create(union bpf_attr *attr) if (IS_ERR(map)) return PTR_ERR(map); - st_map = (struct bpf_struct_ops_map *)map; - if (!bpf_struct_ops_valid_to_reg(map)) { err = -EINVAL; goto put_map; @@ -916,6 +914,7 @@ int bpf_struct_ops_link_create(union bpf_attr *attr) if (err) goto err_out; + st_map = (struct bpf_struct_ops_map *)map; err = st_map->st_ops->reg(st_map->kvalue.data); if (err) { bpf_link_cleanup(&link_primer);