Skip to contentSkip to conversation

Suspicious fall through in qemu_default_pixelformat()

Qemu-devel Markus Armbruster 3 participants 6 messages Nov 22, 2011

lore
Share & tools
lore
#0 lore raw

Case 24 falls through to case 32, which overwrites all of case 24's work. Looks wrong. Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes. Stefano, can you help?

#1 lore raw
Quoted 7 lines · Markus Armbruster

Case 24 falls through to case 32, which overwrites all of case 24's work.  Looks wrong.  Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes.  Stefano, can you help?

(I don't have an 'o' at the end of my name, but...)

The 24 bpp and 32 bpp formats are the same except 32 bpp adds an 8-bit alpha component. We can safely insert a break.

I'm confused about the alpha component though. It seems we discard alpha for 32 bpp. It's unclear whether this is intentional or has just never been noticed because we don't use alpha anyway.

Stefan

#2 lore raw
Quoted 5 lines · Stefan Hajnoczi
Quoted 4 lines · Markus Armbruster

Case 24 falls through to case 32, which overwrites all of case 24's work.  Looks wrong.  Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Quoted 8 lines
Quoted 3 lines

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes.  Stefano, can you help?

(I don't have an 'o' at the end of my name, but...)

The 24 bpp and 32 bpp formats are the same except 32 bpp adds an 8-bit alpha component. We can safely insert a break.

indeed

Quoted 3 lines

I'm confused about the alpha component though. It seems we discard alpha for 32 bpp. It's unclear whether this is intentional or has just never been noticed because we don't use alpha anyway.

we don't use alpha

#3 lore raw
In reply to Markus Armbruster
Quoted 7 lines · Markus Armbruster

Case 24 falls through to case 32, which overwrites all of case 24's work. Looks wrong. Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes. Stefano, can you help?

You are right, there should be a break statement there. However it doesn't matter in practice because the 24 and 32 bit settings are the same (amask, ashift and abits don't matter much).

#4 lore raw
Quoted 5 lines · Stefano Stabellini
Quoted 4 lines · Markus Armbruster

Case 24 falls through to case 32, which overwrites all of case 24's work. Looks wrong. Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Quoted 7 lines
Quoted 3 lines

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes. Stefano, can you help?

You are right, there should be a break statement there. However it doesn't matter in practice because the 24 and 32 bit settings are the same (amask, ashift and abits don't matter much).

I'll post the obvious patch then. Thanks!

#5 lore raw
Quoted 11 lines · Markus Armbruster
Quoted 9 lines · Stefano Stabellini
Quoted 7 lines · Markus Armbruster

Case 24 falls through to case 32, which overwrites all of case 24's work. Looks wrong. Git blames commit 0da2ea1b "fix endianness problem sharing the videoram buffer".

Patching in a break is easy enough, but since I don't actually understand how the function is used, I have no idea what exactly this fixes. Stefano, can you help?

Quoted 5 lines
Quoted 3 lines

You are right, there should be a break statement there. However it doesn't matter in practice because the 24 and 32 bit settings are the same (amask, ashift and abits don't matter much).

I'll post the obvious patch then. Thanks!

you are welcome