lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 19 Apr 2021 19:52:09 -0400
From:   calvin.walton@...stin.ca
To:     Terry Bowman <terry.bowman@....com>, lenb@...nel.org,
        yu.c.chen@...el.com, linux-pm@...r.kernel.org,
        linux-kernel@...r.kernel.org, bp@...e.de
Cc:     wei.huang2@....com
Subject: Re: [PATCH v2] tools/power turbostat: Fix RAPL summary collection
 on AMD processors

On Mon, 2021-04-19 at 14:58 -0500, Terry Bowman wrote:

@@ -3281,7 +3326,7 @@ static int update_msr_sum(struct thread_data *t, struct core_data *c, struct pkg
                        continue;
                ret = get_msr(cpu, offset, &msr_cur);
                if (ret) {
-                       fprintf(outf, "Can not update msr(0x%x)\n", offset);
+                       fprintf(outf, "Can not update msr(0x%lx)\n", offset);

This gives a warning when compiled on 32-bit, since turbostat is
compiled with -D_FILE_OFFSET_BITS=64:

turbostat.c: In function 'update_msr_sum':
turbostat.c:3329:42: warning: format '%lx' expects argument of type
'long unsigned int', but argument 3 has type 'off_t' {aka 'long long
int'} [-Wformat=]
 3329 |    fprintf(outf, "Can not update msr(0x%lx)\n", offset);
      |                                        ~~^      ~~~~~~
      |                                          |      |
      |                                          |      off_t {aka long long int}
      |                                          long unsigned int
      |                                        %llx

Easiest fix is probably to cast to (long long int) and use the %llx
format specifier. That should be valid with i686, x32, and amd64
userspace.

Everything else looks fine as far as I can tell, so feel free to add a

Reviewed-by: Calvin Walton <calvin.walton@...stin.ca>

once you've fixed that warning.


-- 
 <calvin.walton@...stin.ca>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ