From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) (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 05A2741D212 for ; Mon, 14 Sep 2026 21:44:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789422293; cv=none; b=dpOBvIU5YdQmr7i8tBVdnMrEOTZw3/QZYeHG/L4J0DBYHE56AxlKgDJpBKjLXiCQYoHvSfCABOCihHzcqyUbYL93183HI+9DL950JlsHqIku08kRbi3kyeFcfygBlGFh/nF89QFIGFow/bKNGRWnhRNqpNEeeTDTwOiL7+l0Ie4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789422293; c=relaxed/simple; bh=jq28sXgMOG83pqsfn4DsTwpWb6M2x0VMwZWrEfMyIQw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iX+bytYrFUC93VTGEubP9rulx49Jo72vJ3ZD5vFWKICxaTq6cH2f9pfbQoKxTu1kVH3r+XGrLazwLOd1Bsce6ST8JUdRlr4CqkngWizG/+5damxc8rvwDbF1Bx9oYmvzehpB8VxIMdvMgKk72yITHuKS/Onbo6fvs2ENl5bm2HY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F5k0jKWA; arc=none smtp.client-ip=209.85.221.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F5k0jKWA" Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-47de0093c42so3584800f8f.3 for ; Mon, 14 Sep 2026 14:44:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789422288; x=1790027088; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=MMWuFoZNpTbVauKFWQOZe8Q8+oQNvVLrh3IMG7Y4F/I=; b=F5k0jKWA5V7fsrPZW1nrHXuRGeJXyZ58u3g3QbvJYBLesJa7CsHFAcUr8F6NDqwRZg rldl7fTLMER31itXf6qPIcl5CK2PeJI/mtnDyg4h3IsTrxctV/75DAFB7xz+71jc8jHI FTSPkI6hSWQePq2HVJovw4Y0Qhbs11GUMbzc4npv+ply1DiqrpenWVxLy0/mp0QHhPPA apF+kSzyr+CS5A2IMOgQlxZ4/G47QCoDPsQezvtRAYpKyRE2qIQln9KxX5iMdnkqs9Z5 4igLWbBdBqy8XCJkGoUoOGIncMjtJ7IPRa+WaIklABXnV2vaoqDENZuuSoEbc8ciwmD3 W5cQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789422288; x=1790027088; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=MMWuFoZNpTbVauKFWQOZe8Q8+oQNvVLrh3IMG7Y4F/I=; b=uOSoN9OJ0WGMzlVxgc5Yf/t5atWDOHs2B27Xvxv5r/3BZNKpPCdKz63B5QoOJPEpNG QTFhvuCPgCrQuNgCKRPiRBuS+mywljyJl1rY1Wul+0m1fBkC8x0wyMUr09aX2mi73ZGJ 7EQB9qhqP5nZccUL+1N79+gxjp8qMJfuST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789422288113; Mon, 14 Sep 2026 14:44:48 -0700 (PDT) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-486eb2ed0fbsm29878025f8f.3.2026.09.14.14.44.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 14:44:47 -0700 (PDT) Date: Mon, 14 Sep 2026 22:44:32 +0100 From: David Laight To: Markus Elfring Cc: Lorenzo Stoakes , linux-kbuild@vger.kernel.org, x86@kernel.org, Albert Ou , Alexandre Courbot , Alexandre Ghiti , Alexey Gladkov , Alice Ryhl , Andreas Hindborg , Ard Biesheuvel , Arnd Bergmann , Benno Lossin , Bill Wendling , =?UTF-8?B?QmrDtnJu?= Roy Baron , Boqun Feng , Borislav Petkov , Catalin Marinas , Daniel Almeida , Danilo Krummrich , Dave Hansen , Gary Guo , "Gustavo A. R. Silva" , "H. Peter Anvin" , Ilias Apalodimas , Ingo Molnar , Jonathan Corbet , Josh Poimboeuf , Justin Stitt , Kees Cook , Linus Torvalds , Mark Rutland , Masahiro Yamada , Miguel Ojeda , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Onur =?UTF-8?B?w5Z6a2Fu?= , Palmer Dabbelt , Paul Walmsley , Peter Zijlstra , Randy Dunlap , Tamir Duberstein , Thomas Gleixner , Trevor Gross , Will Deacon , LKML , kernel-janitors@vger.kernel.org, linux-hardening@vger.kernel.org, linux-doc@vger.kernel.org, linux-efi@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-arch@vger.kernel.org, llvm@lists.linux.dev, linux-riscv@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jens Axboe Subject: Re: [PATCH v2 03/21] kallsyms: output binary data to speed output and kallsyms assembly Message-ID: <20260914224432.7ed40d48@pumpkin> In-Reply-To: References: <20260914-build-speedup-v2-3-39817ec5db23@kernel.org> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-hardening@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 14 Sep 2026 22:16:12 +0200 Markus Elfring wrote: > =E2=80=A6 > > +++ b/scripts/kallsyms.c =20 > =E2=80=A6 > > @@ -413,26 +438,24 @@ static void write_src(void) > > /* Encode length with ULEB128. */ > > if (table[i]->len <=3D 0x7F) { > > /* Most symbols use a single byte for the length. */ > > - printf("\t.byte 0x%02x", table[i]->len); > > + fputc(table[i]->len, out_bin_file); > > off +=3D table[i]->len + 1; > > } else { > > /* "Big" symbols use two bytes. */ > > - printf("\t.byte 0x%02x, 0x%02x", > > - (table[i]->len & 0x7F) | 0x80, > > - (table[i]->len >> 7) & 0x7F); > > + fputc((table[i]->len & 0x7F) | 0x80, out_bin_file); > > + fputc((table[i]->len >> 7) & 0x7F, out_bin_file); > > off +=3D table[i]->len + 2; > > } > > - for (k =3D 0; k < table[i]->len; k++) > > - printf(", 0x%02x", table[i]->sym[k]); > > + fwrite(table[i]->sym, 1, table[i]->len, out_bin_file); > > =20 > > /* > > * Now that we wrote out the compressed symbol name, restore the > > - * original name and print it in the comment. > > + * original name for the comments below. > > */ > > expand_symbol(table[i]->sym, table[i]->len, buf); > > strcpy((char *)table[i]->sym, buf); > > - printf("\t/* %s */\n", table[i]->sym); > > } > > + write_incbin(out_bin_name, bin_start, bin_pos(out_bin_file)); > > printf(".size kallsyms_names, . - kallsyms_names\n"); > > printf("\n"); > > =20 > =E2=80=A6 >=20 > I suggest to avoid return value ignorance a bit more. > https://cmu-sei.github.io/secure-coding-standards/sei-cert-c-coding-stand= ard/rules/error-handling-err/err33-c/ > https://cwe.mitre.org/data/definitions/252.html And I suggest you do some real coding... The error is sticky and can be checked using ferror(). Code that looks at the return value from fprintf() fwrite() etc is very often broken because the only time they can actual fail is when the buffer is flushed during close. Adding error checks to every call just make the code unreadable. David >=20 > Regards, > Markus