* [Qemu-devel] [PATCH] hw/audio/intel-hda: Avoid shift into sign bit
@ 2014-05-09 13:22 Peter Maydell
2014-05-09 14:07 ` Gerd Hoffmann
0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2014-05-09 13:22 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Vassili Karpov (malc), Gerd Hoffmann, patches
Add a U suffix to avoid shifting into the sign bit (which is
undefined behaviour in C).
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
Another one from clang's sanitizer...
hw/audio/intel-hda.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/audio/intel-hda.c b/hw/audio/intel-hda.c
index d41f82c..0cec2d2 100644
--- a/hw/audio/intel-hda.c
+++ b/hw/audio/intel-hda.c
@@ -245,7 +245,7 @@ static void intel_hda_update_int_sts(IntelHDAState *d)
/* update global status */
if (sts & d->int_ctl) {
- sts |= (1 << 31);
+ sts |= (1U << 31);
}
d->int_sts = sts;
@@ -257,7 +257,7 @@ static void intel_hda_update_irq(IntelHDAState *d)
int level;
intel_hda_update_int_sts(d);
- if (d->int_sts & (1 << 31) && d->int_ctl & (1 << 31)) {
+ if (d->int_sts & (1U << 31) && d->int_ctl & (1U << 31)) {
level = 1;
} else {
level = 0;
--
1.9.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] hw/audio/intel-hda: Avoid shift into sign bit
2014-05-09 13:22 [Qemu-devel] [PATCH] hw/audio/intel-hda: Avoid shift into sign bit Peter Maydell
@ 2014-05-09 14:07 ` Gerd Hoffmann
0 siblings, 0 replies; 2+ messages in thread
From: Gerd Hoffmann @ 2014-05-09 14:07 UTC (permalink / raw)
To: Peter Maydell; +Cc: qemu-trivial, Vassili Karpov (malc), qemu-devel, patches
On Fr, 2014-05-09 at 14:22 +0100, Peter Maydell wrote:
> Add a U suffix to avoid shifting into the sign bit (which is
> undefined behaviour in C).
Added to audio patch queue.
thanks,
Gerd
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-09 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-09 13:22 [Qemu-devel] [PATCH] hw/audio/intel-hda: Avoid shift into sign bit Peter Maydell
2014-05-09 14:07 ` Gerd Hoffmann
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).