From nobody Sun Feb 8 21:32:28 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1623926707; cv=none; d=zohomail.com; s=zohoarc; b=jmO/GIvKxJG9xqstRXj4pzgyE9CzEDilJVlbcE7HWrBnmRXTXftcRHp8fcs7YQ4rN1KIAhSBVc79QtP7a6JHpg8j9EJ4uxFhtvHjjHFunAXJ+LF/RGB6WG9+ViRCaZUUQU38cIgRWIKvMV9MPvkgz7VI8sW6FaF79IPIOVzUWZM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1623926707; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=RH6jpkMxUGCCvJ4CRsC9TVEiIp0ohmAxT4j0QJzavJs=; b=Ex4yUusaAs4FFt10/qINeADu7bARtbpu2ImYaP8OqOJ3RRiPYkPlFn72cZUALvvso0sxX4CYp02zgaL05hzjx9O8vW54LYcSZJcjOjl63YICtH7hcTZjCt0+OP81zWA6dDDkLEvwxpUWfXe7dffFgpv+/yGwy0VAp2T3AdjR0Mg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 162392670753766.86395086308448; Thu, 17 Jun 2021 03:45:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-419-Hs7Irs4TPqypoGRuOR4sGQ-1; Thu, 17 Jun 2021 06:45:04 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E841C8018A7; Thu, 17 Jun 2021 10:44:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C836F60CCB; Thu, 17 Jun 2021 10:44:58 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8B31846F5E; Thu, 17 Jun 2021 10:44:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 15HAgIk4018932 for ; Thu, 17 Jun 2021 06:42:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id D3E5D19D61; Thu, 17 Jun 2021 10:42:18 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.183]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5798319D7D for ; Thu, 17 Jun 2021 10:42:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1623926706; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=RH6jpkMxUGCCvJ4CRsC9TVEiIp0ohmAxT4j0QJzavJs=; b=LXHr67ccRwHB1Q/u1EJndMu0g4eKlazXsLFC91cXDMUzvlj/DJURIj1ZHsus1T6P4jzgms klrGlb0mj2qoJqEU9db0KgjwvJnQg+YeVsqh7Yt/x+RGWNTXv6ETRNzwQ7xf0TGpOfvZhi r1sOXnoNHWckgTWxs0lAJsABgOA3cxA= X-MC-Unique: Hs7Irs4TPqypoGRuOR4sGQ-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 6/8] virSecurityDACSetOwnershipInternal: Don't overwrite @path argument Date: Thu, 17 Jun 2021 12:42:06 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" As shown in the previous commit, @path can be NULL. However, in that case @src->path is also NULL. Therefore, trying to "fix" @path to be not NULL is not going to succeed. The real value of NULLSTR() is in providing a non-NULL string for error reporting. Well, that can be done in the error reporting without overwriting argument. Signed-off-by: Michal Privoznik --- src/security/security_dac.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/security/security_dac.c b/src/security/security_dac.c index e2a6461375..603d5b98ef 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -679,8 +679,6 @@ virSecurityDACSetOwnershipInternal(const virSecurityDAC= Data *priv, =20 if (src && priv->chownCallback) { rc =3D priv->chownCallback(src, uid, gid); - /* here path is used only for error messages */ - path =3D NULLSTR(src->path); =20 /* on -2 returned an error was already reported */ if (rc =3D=3D -2) @@ -712,20 +710,20 @@ virSecurityDACSetOwnershipInternal(const virSecurityD= ACData *priv, if (errno =3D=3D EOPNOTSUPP || errno =3D=3D EINVAL) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "supported by filesystem", - (long)uid, (long)gid, path); + (long)uid, (long)gid, NULLSTR(path)); } else if (errno =3D=3D EPERM) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "permitted", - (long)uid, (long)gid, path); + (long)uid, (long)gid, NULLSTR(path)); } else if (errno =3D=3D EROFS) { VIR_INFO("Setting user and group to '%ld:%ld' on '%s' not " "possible on readonly filesystem", - (long)uid, (long)gid, path); + (long)uid, (long)gid, NULLSTR(path)); } else { virReportSystemError(errno, _("unable to set user and group to '%ld:%= ld' " "on '%s'"), - (long)uid, (long)gid, path); + (long)uid, (long)gid, NULLSTR(path)); return -1; } } --=20 2.31.1