qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: John Snow <jsnow@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PULL 00/11] Ide patches
Date: Mon, 11 Jan 2016 12:18:17 -0500	[thread overview]
Message-ID: <5693E3D9.60401@redhat.com> (raw)
In-Reply-To: <CAFEAcA-Qt=ipRSgOFLVp8b85Hh5R-BFQLk4QfpoJpY0iQ=WNVg@mail.gmail.com>



On 01/11/2016 06:18 AM, Peter Maydell wrote:
> On 9 January 2016 at 00:51, John Snow <jsnow@redhat.com> wrote:
>> The following changes since commit 38a762fec63fd5c035aae29ba9a77d357e21e4a7:
>>
>>   Merge remote-tracking branch 'remotes/berrange/tags/pull-crypto-fixes-2015-12-23-1' into staging (2015-12-23 13:53:32 +0000)
>>
>> are available in the git repository at:
>>
>>   https://github.com/jnsnow/qemu.git tags/ide-pull-request
>>
>> for you to fetch changes up to 4160ad843841df21de296016fb77f986e693bed2:
>>
>>   libqos/ahci: organize header (2016-01-08 15:22:34 -0500)
>>
>> ----------------------------------------------------------------
>>
>> ----------------------------------------------------------------
> 
> These seem to result in some new clang sanitizer runtime warnings
> during a 'make check':
> 
> /home/petmay01/linaro/qemu-for-merges/tests/libqos/ahci.c:963:9:
> runtime error: store to misaligned address 0x2adacfbaacd7 for type
> 'uint16_t' (aka 'unsigned short'), which requires 2 byte alignment
> 0x2adacfbaacd7: note: pointer points here
>  00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  21
> 00 00 00 00 00 00 00  6c 6f 6e
>              ^
> /home/petmay01/linaro/qemu-for-merges/tests/libqos/ahci.c:907:9:
> runtime error: store to misaligned address 0x2adacfbaacd2 for type
> 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
> 0x2adacfbaacd2: note: pointer points here
>  00 00  28 00 00 00 00 00 00 00  01 00 00 00 00 00 00 00  00 00 00 00
> 00 00 00 00  21 00 00 00 00 00
>               ^
> 
> This kind of thing:
> 

"This kind of thing" as one might say while holding up a rotting fish
with just two fingers, held at arm's length.

>     unsigned char *cbd = cmd->atapi_cmd;
>     uint32_t *lba32;
> 
>         lba32 = (uint32_t *)&(cbd[2]);
>         *lba32 = cpu_to_be32(lba);
> 
> isn't valid. You probably want
>  stl_be_p(&cbd[2], lba);
> 
> (defined in qemu/bswap.h).
> 
> thanks
> -- PMM
> 

Thanks for the pointer. Out of curiosity, is there no standard way to
perform this kind of operation in C? I want to adjust my bad habits. In
QEMU I can remember to use these macros now that I know they're there,
but not sure what I'd use in other projects. memcpy directly?

--js

  reply	other threads:[~2016-01-11 17:18 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-09  0:51 [Qemu-devel] [PULL 00/11] Ide patches John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 01/11] macio: fix overflow in lba to offset conversion for ATAPI devices John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 02/11] ide: ahci: reset ncq object to unused on error John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 03/11] ahci-test: fix memory leak John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 04/11] libqos/ahci: ATAPI support John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 05/11] libqos/ahci: ATAPI identify John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 06/11] libqos/ahci: Switch to mutable properties John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 07/11] libqos: allow zero-size allocations John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 08/11] libqos/ahci: allow nondata commands for ahci_io variants John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 09/11] libqos/ahci: add ahci_exec John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 10/11] qtest/ahci: ATAPI data tests John Snow
2016-01-09  0:51 ` [Qemu-devel] [PULL 11/11] libqos/ahci: organize header John Snow
2016-01-11 11:18 ` [Qemu-devel] [PULL 00/11] Ide patches Peter Maydell
2016-01-11 17:18   ` John Snow [this message]
2016-01-11 17:36     ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2017-09-16  1:03 John Snow
2017-09-16  1:29 ` no-reply
2017-09-16 14:34 ` Peter Maydell
2017-09-18 13:51   ` Eric Blake
2017-09-18 17:55   ` John Snow
2017-09-18 18:00     ` Peter Maydell
2017-09-18 18:14       ` Peter Maydell
2017-09-20 17:02         ` Mark Cave-Ayland
2017-09-20 17:55           ` John Snow
2017-09-20 19:01             ` Mark Cave-Ayland
2016-02-10 19:37 John Snow
2016-02-10 19:37 ` John Snow
2016-02-11 15:09   ` Peter Maydell
2015-09-18 15:04 John Snow
2015-09-18 17:32 ` Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5693E3D9.60401@redhat.com \
    --to=jsnow@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).