From nobody Tue Dec 2 01:51:21 2025 Received: from out-182.mta0.migadu.com (out-182.mta0.migadu.com [91.218.175.182]) (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 281EE18E025 for ; Thu, 20 Nov 2025 22:18:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763677140; cv=none; b=BLzCVPQulDbWNbwynR123G1H9Yk4rPCtz+/LcUHPR0JN0KqxaVRin8zunT36N5N7cCrPuR58/5SLOCtu/GPt52d64KFi07KCuiBfzue21D3TX7pOoz3Of5CMC7KZYudXaVb7Sy1zZ6HfeVwD1J9vO2msRJrD9i+mtbvi5GboctE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763677140; c=relaxed/simple; bh=cJSeUxGY8XC3dk5mUKO7+qX0PGXCEVnimCT1P2KcqbU=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QkLiS0QA4IINX3o8r91i7cPzYGb3g2G2Livm0UjSObHxsWhUHJhw6dL+2YXahxsbUjd0ijRWk+gipzCPBFgj4S3GocQghTmgTGAjpphshXp8dak1rJawguJi+Dr7yTCm5yTkl21W1nn3bw1K/gfdv3M8K2hjZENazCMgo9T82Kk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=LSP8Cexb; arc=none smtp.client-ip=91.218.175.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="LSP8Cexb" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1763677136; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=z7bwPIb7BcXZlPEbuaeQfZQccLAREIARhtmmB75Hwo0=; b=LSP8CexbeXjDt0IBfOxyUOqTygzefVMveijKXL6j51cD6H1CQZLEhANoFm2pTZcYdQaVLK 6uQ42g/TBDP8UPEcHxxZdvC1m3DVBqyXzlYzRRTAP/y7z9sMtdvrbEyH8VGgyyZVLRtDfz aHdQ/ucOPmOGZY6Qp/93McUu1HyvfYU= From: Thorsten Blum To: Tyler Hicks , Ard Biesheuvel , Christian Brauner , Eric Biggers Cc: Thorsten Blum , ecryptfs@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ecryptfs: Drop redundant NUL terminations after calling ecryptfs_to_hex Date: Thu, 20 Nov 2025 23:17:57 +0100 Message-ID: <20251120221800.9985-3-thorsten.blum@linux.dev> 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 X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" ecryptfs_to_hex() already NUL-terminates the destination buffers. Drop the manual NUL terminations. Signed-off-by: Thorsten Blum --- Changes in v2: - Remove all redundant NUL terminations after calling ecryptfs_to_hex - Link to v1: https://lore.kernel.org/lkml/20251120214535.5952-2-thorsten.b= lum@linux.dev/ --- fs/ecryptfs/debug.c | 1 - fs/ecryptfs/keystore.c | 3 --- 2 files changed, 4 deletions(-) diff --git a/fs/ecryptfs/debug.c b/fs/ecryptfs/debug.c index cf6d0e8e25a1..c185a8cb5fe2 100644 --- a/fs/ecryptfs/debug.c +++ b/fs/ecryptfs/debug.c @@ -28,7 +28,6 @@ void ecryptfs_dump_auth_tok(struct ecryptfs_auth_tok *aut= h_tok) ecryptfs_printk(KERN_DEBUG, " * passphrase type\n"); ecryptfs_to_hex(salt, auth_tok->token.password.salt, ECRYPTFS_SALT_SIZE); - salt[ECRYPTFS_SALT_SIZE * 2] =3D '\0'; ecryptfs_printk(KERN_DEBUG, " * salt =3D [%s]\n", salt); if (auth_tok->token.password.flags & ECRYPTFS_PERSISTENT_PASSWORD) { diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c index 3a6283477d61..9f53069bbc7c 100644 --- a/fs/ecryptfs/keystore.c +++ b/fs/ecryptfs/keystore.c @@ -908,7 +908,6 @@ ecryptfs_parse_tag_70_packet(char **filename, size_t *f= ilename_size, (*packet_size) +=3D s->packet_size_len; ecryptfs_to_hex(s->fnek_sig_hex, &data[(*packet_size)], ECRYPTFS_SIG_SIZE); - s->fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX] =3D '\0'; (*packet_size) +=3D ECRYPTFS_SIG_SIZE; s->cipher_code =3D data[(*packet_size)++]; rc =3D ecryptfs_cipher_code_to_string(s->cipher_string, s->cipher_code); @@ -1777,8 +1776,6 @@ int ecryptfs_parse_packet_set(struct ecryptfs_crypt_s= tat *crypt_stat, } ecryptfs_to_hex(new_auth_tok->token.password.signature, sig_tmp_space, tag_11_contents_size); - new_auth_tok->token.password.signature[ - ECRYPTFS_PASSWORD_SIG_SIZE] =3D '\0'; crypt_stat->flags |=3D ECRYPTFS_ENCRYPTED; break; case ECRYPTFS_TAG_1_PACKET_TYPE: --=20 2.51.1