> 30 окт. 2024 г., в 22:03, Phil Dennis-Jordan <li...@philjordan.eu> написал(а):
> 
> 
> On Wed 30. Oct 2024 at 15:09, Anastasia Belova <abel...@astralinux.ru> wrote:
> default case has no condition. So if it is placed
> higher that other cases, they are unreachable.
> 
> Move dafult case down.
> 
> The stylistic merits might be debatable, but: the order of cases in a switch 
> block in C does not matter, the default case can appear anywhere. The other 
> cases are still reachable. So at minimum, the commit message is incorrect.
> 

You’re right, I didn’t know about this. Thank you for reply and patience!

Anastasia Belova

> Found by Linux Verification Center (linuxtesting.org)
> 
> Signed-off-by: Anastasia Belova <abel...@astralinux.ru>
> ---
> monitor/hmp-cmds-target.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/monitor/hmp-cmds-target.c b/monitor/hmp-cmds-target.c
> index ff01cf9d8d..eea8ca047b 100644
> --- a/monitor/hmp-cmds-target.c
> +++ b/monitor/hmp-cmds-target.c
> @@ -189,7 +189,6 @@ static void memory_dump(Monitor *mon, int count, int 
> format, int wsize,
>       i = 0;
>       while (i < l) {
>           switch(wsize) {
> -            default:
>           case 1:
>               v = ldub_p(buf + i);
>               break;
> @@ -202,6 +201,9 @@ static void memory_dump(Monitor *mon, int count, int 
> format, int wsize,
>           case 8:
>               v = ldq_p(buf + i);
>               break;
> +            default:
> +                v = ldub_p(buf + i);
> +                break;
>           }
>           monitor_printf(mon, " ");
>           switch(format) {
> -- 
> 2.47.0

Reply via email to