From nobody Fri Apr 19 11:09:46 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1557501784; cv=none; d=zoho.com; s=zohoarc; b=C+XVPePob7BsY2CN78L63zIT1sSb+rM7M8vmCnCAo8vi7rGDVNKiRzXBznhKgmY5vLL8gfL38szU1nachjpDG/Q9ir3rJ37rUi7TVZyiTDKCV1u9XAfZnvL3iIrXkMVDuQrGeTA7477SLR6yWjoPsGQpVMaoWOF8s5pzMiSghaU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557501784; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=EDg1LX1r8njQNkQ7ttdY2nawl6lvRRZ9OjFqBuJPLjk=; b=D75BteGk+T4JjgnsmUOat9KmdQbXrdjWmvezKF+RIZxgFL1DDGUAXGcCdPMh3hl++NAYPtAuvF+7uiL0NyQ0ctd/9zCWoRa7ODN8Q8G3cbivvYPpFR1sYeIMRRJwXNyDbANIoC+KjwonTCyHbxrnvdCj6FAtWp5tYClXYzOSeLY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557501784619430.2577977095423; Fri, 10 May 2019 08:23:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F803082206; Fri, 10 May 2019 15:23:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A502F61980; Fri, 10 May 2019 15:23:01 +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 CC5E018089CC; Fri, 10 May 2019 15:22:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x4AFMw49022887 for ; Fri, 10 May 2019 11:22:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 689C2600CC; Fri, 10 May 2019 15:22:58 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 627C06012E for ; Fri, 10 May 2019 15:22:56 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4640D2CD7EC for ; Fri, 10 May 2019 15:22:55 +0000 (UTC) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 May 2019 08:22:54 -0700 Received: from david-unc.bj.intel.com ([10.238.145.63]) by fmsmga005.fm.intel.com with ESMTP; 10 May 2019 08:22:53 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 From: Wang Huaqiang To: libvir-list@redhat.com Date: Fri, 10 May 2019 23:21:47 +0800 Message-Id: <1557501707-17646-1-git-send-email-huaqiang.wang@intel.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 15:22:55 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 10 May 2019 15:22:55 +0000 (UTC) for IP:'134.134.136.65' DOMAIN:'mga03.intel.com' HELO:'mga03.intel.com' FROM:'huaqiang.wang@intel.com' RCPT:'' X-RedHat-Spam-Score: -5.001 (RCVD_IN_DNSWL_HI, SPF_PASS) 134.134.136.65 mga03.intel.com 134.134.136.65 mga03.intel.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: huaqiang.wang@intel.com Subject: [libvirt] [PATCH] util: fix a bug found in sorting cache monitor results 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Fri, 10 May 2019 15:23:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Huaqiang The qsort element is a pointer of virResctrlMonitorStats, and the comparing function's arguments have a type of pointer of virResctrlMonitorStatsPtr. Signed-off-by: Huaqiang --- src/util/virresctrl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index b845f36..a190977 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -2659,8 +2659,8 @@ static int virResctrlMonitorStatsSorter(const void *a, const void *b) { - return ((virResctrlMonitorStatsPtr)a)->id - - ((virResctrlMonitorStatsPtr)b)->id; + return (*(virResctrlMonitorStatsPtr *)a)->id + - (*(virResctrlMonitorStatsPtr *)b)->id; } =20 =20 @@ -2758,7 +2758,7 @@ virResctrlMonitorGetStats(virResctrlMonitorPtr monito= r, =20 /* Sort in id's ascending order */ if (*nstats) - qsort(*stats, *nstats, sizeof(*stat), virResctrlMonitorStatsSorter= ); + qsort(*stats, *nstats, sizeof(stat), virResctrlMonitorStatsSorter); =20 ret =3D 0; cleanup: --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list