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 picard.linux.it (picard.linux.it [213.254.12.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BABAFC88E4C for ; Fri, 11 Sep 2026 08:01:41 +0000 (UTC) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 43ED63E724D for ; Fri, 11 Sep 2026 10:01:40 +0200 (CEST) Received: from in-6.smtp.seeweb.it (in-6.smtp.seeweb.it [IPv6:2001:4b78:1:20::6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1)) (No client certificate requested) by picard.linux.it (Postfix) with ESMTPS id AAAF03C0E10 for ; Fri, 11 Sep 2026 10:01:23 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by in-6.smtp.seeweb.it (Postfix) with ESMTPS id D970F1400DD3 for ; Fri, 11 Sep 2026 10:01:22 +0200 (CEST) Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id E4C231FF00; Fri, 11 Sep 2026 08:01:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1789113677; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/v4CWjrENdQ98y917azM/eY1n5qegjD+insfwDk3JTw=; b=OG5mrIyV9VB8TbopZBdJ5lPH8DVsOAw639tX68wdXfYDfrw/pczHUVWQvgkGiMdtyHyYqo vwkirtqQ3jBgg2+2grqamV+HW1zvEJa1ywNhkUS1dXGy9yWMTb/+2dNUVcEVatRIQ8VQMi hir4SRBpQ38lqlEcaHXRLuRssqEFI6I= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1789113677; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/v4CWjrENdQ98y917azM/eY1n5qegjD+insfwDk3JTw=; b=c0l/Vh1XfxQRKPMP7RB9yFJ4zS59oSQjjzJUgl+iFhNMli0eJsnjan1sHtvg/K6K1uYrFl J8X2Wu2AYh4js4AQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=E3RtNgNd; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=Fjqfhems DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1789113672; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/v4CWjrENdQ98y917azM/eY1n5qegjD+insfwDk3JTw=; b=E3RtNgNdPMnyzl5+4cGbua5LlyIPIBc8dnj1B5Wda6a29XD/Ndwovp2okDNP3HRMwVpG88 FkELVb8YX6AcRuH3I6X8LrIAbOF/5ocDHyfNoyYQtoDY6dd0AjQZ/KuJAgTPA9sfKX367Y nr8hQGEWfohazj2NM8ZZ0iAFvLKvyGA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1789113672; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/v4CWjrENdQ98y917azM/eY1n5qegjD+insfwDk3JTw=; b=FjqfhemsrVi1mMuk8km+GiKBeA/a3FZnxrV+kmcsj9LcDweZD22WOvgy40zDgijT+Vsm03 GluGRXZq3AgfUGAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B651E137CA; Fri, 11 Sep 2026 08:01:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id RjZ7LEi1o2obaQAAD6G6ig (envelope-from ); Fri, 11 Sep 2026 08:01:12 +0000 Date: Fri, 11 Sep 2026 10:01:14 +0200 From: Cyril Hrubis To: Andrea Cervesato Message-ID: References: <20260904-keyctl_coverage-v2-0-43b78b15ef9f@suse.com> <20260904-keyctl_coverage-v2-3-43b78b15ef9f@suse.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20260904-keyctl_coverage-v2-3-43b78b15ef9f@suse.com> X-Rspamd-Action: no action X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Queue-Id: E4C231FF00 X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; MISSING_XM_UA(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; MIME_TRACE(0.00)[0:+]; DBL_BLOCKED_OPENRESOLVER(0.00)[yuki.lan:mid,suse.cz:dkim,suse.cz:email,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; TO_DN_ALL(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.cz:+] X-Virus-Scanned: clamav-milter 1.0.9 at in-6.smtp.seeweb.it X-Virus-Status: Clean Subject: Re: [LTP] [PATCH v2 03/33] keyctl11: Test KEYCTL_DESCRIBE with exact buffer size X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Linux Test Project Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ltp-bounces+ltp=archiver.kernel.org@lists.linux.it Sender: "ltp" Hi! > +#include "keyctl_common.h" > + > +static key_serial_t key; > +static long desc_len; > +static char *buf; > + > +static void setup(void) > +{ > + SAFE_KEYCTL(KEYCTL_JOIN_SESSION_KEYRING, 0, 0, 0, 0); > + > + key = new_user_key("k", "payload", 7, KEY_SPEC_PROCESS_KEYRING); > + SAFE_KEYCTL(KEYCTL_SETPERM, key, KEY_PERM_SET, 0, 0); > + > + TEST(keyctl(KEYCTL_DESCRIBE, key, (unsigned long)NULL, 0, 0)); > + if (TST_RET < 0) > + tst_brk(TBROK | TTERRNO, "KEYCTL_DESCRIBE failed"); > + > + desc_len = TST_RET; > + buf = SAFE_MALLOC(desc_len); > +} > + > +static void cleanup(void) > +{ > + free(buf); > +} > + > +static void run(void) > +{ > + memset(buf, 0, desc_len); If we are trying to check that the string was copied including the terminating byte we should memset the buffer to 0xff, right? > + TST_EXP_EQ_LI_SILENT(keyctl(KEYCTL_DESCRIBE, key, (unsigned long)buf, > + desc_len, 0), desc_len); > + if (!TST_PASS) > + return; > + > + if (buf[desc_len - 1] != '\0') { > + tst_res(TFAIL, "description is not NUL terminated"); > + return; > + } > + > + tst_res(TPASS, "full description including NUL fits exact %ld byte buffer", > + desc_len); > +} Also this is quite similar to the previous test, maybe it would make sense to put this check in the previous test instead. -- Cyril Hrubis chrubis@suse.cz -- Mailing list info: https://lists.linux.it/listinfo/ltp