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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36F11C38A02 for ; Sat, 29 Oct 2022 23:19:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229853AbiJ2XTI (ORCPT ); Sat, 29 Oct 2022 19:19:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbiJ2XSy (ORCPT ); Sat, 29 Oct 2022 19:18:54 -0400 Received: from zeniv.linux.org.uk (zeniv.linux.org.uk [IPv6:2a03:a000:7:0:5054:ff:fe1c:15ff]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CBD42F00C; Sat, 29 Oct 2022 16:18:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=linux.org.uk; s=zeniv-20220401; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=3I7amQwucLsr9EK3PRzzcIjUWVNxHOmGAMTyGQic/xs=; b=OK9IgIJTUA5Bn/JLGr/q/PnE7b qfPBRQZDcdEMgRa9OV2zbtFoK7zCO9Oa0JgGALwa7IwlbgTcl36O+QAYgRfXSKJMLwfweAe7IZC0b dntraq7P0590C3HCK+HAxyVHp61x0lVHrNe9j/BM0TOuIS9kFolmTQWMKCCtaxvWdm4kY6e3k1cB4 cc4CQmbYSaQJAw3wakeRVehctJN37Ah9l9UjtX7VtNQoQqND/2UxvrCJr2Mjr5XKyq1YaY1x+1Dgu rvGtOBql67edIbabKP2bm6leLuHnuyyEdMNY9/SiO1qYVAznUXAqBvkTbI8U7ZR5WCcIQXoMM4mKW VwhoKUxA==; Received: from viro by zeniv.linux.org.uk with local (Exim 4.96 #2 (Red Hat Linux)) id 1oov6J-00FOKe-1p; Sat, 29 Oct 2022 23:18:51 +0000 From: Al Viro To: linux-arch@vger.kernel.org Cc: Linus Torvalds , linux-kernel@vger.kernel.org Subject: [PATCH 04/10] [elf][regset] clean fill_note_info() a bit Date: Sun, 30 Oct 2022 00:18:44 +0100 Message-Id: <20221029231850.3668437-4-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> References: <20221029231850.3668437-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org *info is already initialized... Signed-off-by: Al Viro --- fs/binfmt_elf.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 002fd713ac11..4190dafd2ec4 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c @@ -1833,24 +1833,17 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, struct elf_thread_core_info *t; struct elf_prpsinfo *psinfo; struct core_thread *ct; - unsigned int i; - - info->size = 0; - info->thread = NULL; psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL); - if (psinfo == NULL) { - info->psinfo.data = NULL; /* So we don't free this wrongly */ + if (!psinfo) return 0; - } - fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); /* * Figure out how many notes we're going to need for each thread. */ info->thread_notes = 0; - for (i = 0; i < view->n; ++i) + for (int i = 0; i < view->n; ++i) if (view->regsets[i].core_note_type != 0) ++info->thread_notes; -- 2.30.2