From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 364D4421F11 for ; Thu, 5 Feb 2026 15:53:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770306799; cv=none; b=Yp4ogWnxOIC7ckeiiAr+QIEndXQmCh0CqMSAZ5ZUjECQS/tVCcj8ObWFd2dLaHdx8xaWzjj/lJkNyICmkzd7NxOstjsbR3qkDfa3NBH3Wxxk9/ahK4aC05hHYMIfwZWXfqrxbyZYvvXcfGOcP3dPYoCXx7TubLumANTm3ayaHr4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770306799; c=relaxed/simple; bh=BvNQP8toLJCzP4InBeCg66IkoQckS9Gld5kou8pVDFY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jZz7TxytD9O8g7iFGpGEJo0hQ6ZXNe+obhFX2gPqg0+1K8ASvjayas9FIR88qf6JcPFazwJiFtFGqtaiklQdWwIJxHbk6wE6hdxPI1+CP9YmJbfNQp1ih0Vm8wZV3M3a7W0s0u7EzRmosRDZ/x+zqvcFiWdNNjh3LuslaR9pW7Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=J48VPXBy; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="J48VPXBy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770306798; h=from:from:reply-to:subject:subject: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=QRJieIvLVa5p1iEpaxUcQ1NO7fwzTV6dGvyMy85+XqI=; b=J48VPXByhYmpYTnYKV0XccwiHrKczN1/KI88KTNNS+GJjQsvG9iAnGtUuHknlBOTY849W5 82ujdHiTynHKtbSq/KJvtOFD7U4dGh65kxiq4YjBDcWZwIvT/pvmRb1hi1L3Q3DOeFE8P6 2wJwmPm+0GXFqPOpJkhNcLjx8csFA4Q= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-475-eB5tZZxfNeqDRKBfD0Y0jA-1; Thu, 05 Feb 2026 10:53:10 -0500 X-MC-Unique: eB5tZZxfNeqDRKBfD0Y0jA-1 X-Mimecast-MFC-AGG-ID: eB5tZZxfNeqDRKBfD0Y0jA_1770306789 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (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 mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 48CE418002E6; Thu, 5 Feb 2026 15:53:09 +0000 (UTC) Received: from redhat.com (unknown [10.22.80.42]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D54B718003F6; Thu, 5 Feb 2026 15:53:07 +0000 (UTC) Date: Thu, 5 Feb 2026 10:53:05 -0500 From: Joe Lawrence To: Josh Poimboeuf Cc: live-patching@vger.kernel.org, Song Liu , Jiri Kosina , Miroslav Benes , Petr Mladek Subject: Re: [PATCH v2 1/5] objtool/klp: Fix mkstemp() failure with long paths Message-ID: References: <20260204025140.2023382-1-joe.lawrence@redhat.com> <20260204025140.2023382-2-joe.lawrence@redhat.com> Precedence: bulk X-Mailing-List: live-patching@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 On Wed, Feb 04, 2026 at 08:47:41AM -0800, Josh Poimboeuf wrote: > On Tue, Feb 03, 2026 at 09:51:36PM -0500, Joe Lawrence wrote: > > @@ -1219,13 +1221,17 @@ struct elf *elf_create_file(GElf_Ehdr *ehdr, const char *name) > > > > base = basename(base); > > > > - tmp_name = malloc(256); > > + tmp_name = malloc(PATH_MAX); > > The allocation size can be more precise with something like > > tmp_name = malloc(strlen(name) + 8); > > Also, I'm scratching my head at the existing code and wondering why we > are splitting out the dirname() and the basename() just to paste them > back together again?? Can you simplify that while you're at it? > > > if (!tmp_name) { > > ERROR_GLIBC("malloc"); > > return NULL; > > } > > > > - snprintf(tmp_name, 256, "%s/%s.XXXXXX", dir, base); > > + path_len = snprintf(tmp_name, PATH_MAX, "%s/%s.XXXXXX", dir, base); > > + if (path_len >= PATH_MAX) { > > + ERROR_GLIBC("snprintf"); > > + return NULL; > > + } > > Checking for all the snprintf() cases can be a pain so we have a > snprintf_check() for a streamlined error checking experience. > Ah, completely missed that, thanks for pointing out. I'll incorporate both suggestions into v3. -- Joe