[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xsm/flask: adjust print messages to use %pd


  • To: Henry Wang <Henry.Wang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Date: Fri, 9 Sep 2022 07:52:07 -0400
  • Arc-authentication-results: i=1; mx.zohomail.com; dkim=pass header.i=apertussolutions.com; spf=pass smtp.mailfrom=dpsmith@xxxxxxxxxxxxxxxxxxxx; dmarc=pass header.from=<dpsmith@xxxxxxxxxxxxxxxxxxxx>
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1662724330; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=Y0Juv2PmzMT0x2kgaZXavJwFRL8oT0cephI3evXdK5Y=; b=AP032NFyeEURXtsfhwwPHnrr2p/iqbbhgz9s7cqBOHBdoJm/vRDXBtUsfSdb5pR2Y8erEXqMxS5hI6b2w+LdROgWcVB99bCSBdeP5XBqJ37Wjnup9D79UDAKOe9mfcNQxZZ0pDmCXTPGS/ClCemeKGTwCUpV2EmcS7RSXmYVRhI=
  • Arc-seal: i=1; a=rsa-sha256; t=1662724330; cv=none; d=zohomail.com; s=zohoarc; b=bp1dIBHfogg1T9u9356xHqbdkX40bDLb9MrbL63UV6KFxy7zCQXR/bpNuDWOxwqjN4PPuX1tBUGShhCYuKBm/04flA4JRHSuUrVgM+EXaQ5JZ7dp4Czpu590ckveKipsvtMcq1Rraf7vJsPnaBWxSckZQDCg/6/Oe5IN6cBG2e4=
  • Cc: "jandryuk@xxxxxxxxx" <jandryuk@xxxxxxxxx>
  • Delivery-date: Fri, 09 Sep 2022 11:52:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 9/9/22 05:56, Henry Wang wrote:
Hi Daniel,

-----Original Message-----
Subject: [PATCH] xsm/flask: adjust print messages to use %pd

Print messages from flask use an inconsistent format when printing the
domain
id. The %pd conversion specifier provides a consistent way to format for the
domain id and aligns with the rest of the hypervisor code.

Signed-off-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
---
  xen/xsm/flask/avc.c   | 8 ++++----
  xen/xsm/flask/hooks.c | 3 +--
  2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/xen/xsm/flask/avc.c b/xen/xsm/flask/avc.c
index 4a75ec97e2..4a86681c81 100644
--- a/xen/xsm/flask/avc.c
+++ b/xen/xsm/flask/avc.c
@@ -566,14 +566,14 @@ void avc_audit(u32 ssid, u32 tsid, u16 tclass, u32
requested,
      if ( a && (a->sdom || a->tdom) )
      {
          if ( a->sdom && a->tdom && a->sdom != a->tdom )
-            avc_printk(&buf, "domid=%d target=%d ", a->sdom->domain_id, a-
tdom->domain_id);
+            avc_printk(&buf, "source=%pd target=%dp ", a->sdom, a->tdom);

I guess this should be target=%pd?

Erg! Turns out there is no conversion specifier validation occurring for avc_printk(), thus the typo slipped through and not caught by the compiler. I will fix and also add the printf annotation to avc_printk() to help ensure conversion specifier and parameter types match.

With this fixed:
Reviewed-by: Henry Wang <Henry.Wang@xxxxxxx>

Thanks!

This should also be fine to merge in 4.17, but following the discussion with
Julien and Jan I think providing a Release ack would lead to confusion...

I was hoping it would go in, but understand if it is kept out. I have a list of clean-ups of varying sizes for XSM, with this one actually being requested by someone else. I figured it was a simple one that could be done quickly and might be worth trying to get it into the release.

v/r,
dps



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.