All of lore.kernel.org
 help / color / mirror / Atom feed
From: LIU Zhiwei <zhiwei_liu@c-sky.com>
To: Alistair Francis <alistair.francis@wdc.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: alistair23@gmail.com, bmeng.cn@gmail.com, palmer@dabbelt.com
Subject: Re: [PATCH v1 1/1] target/riscv/pmp: Add assert for ePMP operations
Date: Fri, 21 May 2021 10:30:52 +0800	[thread overview]
Message-ID: <e5ce3d0a-a50a-0c63-80d0-acfcfbe698a2@c-sky.com> (raw)
In-Reply-To: <ec5f225928eec448278c82fcb1f6805ee61dde82.1621550996.git.alistair.francis@wdc.com>

Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com>

On 5/21/21 6:55 AM, Alistair Francis wrote:
> Although we construct epmp_operation in such a way that it can only be
> between 0 and 15 Coverity complains that we don't handle the other
> possible cases. To fix Coverity and make it easier for humans to read
> add a default case to the switch statement that calls
> g_assert_not_reached().
>
> Fixes: CID 1453108
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>   target/riscv/pmp.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index 78203291de..82ed020b10 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -402,6 +402,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
>                       case 15:
>                           *allowed_privs = PMP_READ;
>                           break;
> +                    default:
> +                        g_assert_not_reached();
>                       }
>                   } else {
>                       switch (epmp_operation) {
> @@ -433,6 +435,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
>                       case 7:
>                           *allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;
>                           break;
> +                    default:
> +                        g_assert_not_reached();
>                       }
>                   }
>               }



WARNING: multiple messages have this Message-ID (diff)
From: LIU Zhiwei <zhiwei_liu@c-sky.com>
To: Alistair Francis <alistair.francis@wdc.com>,
	qemu-devel@nongnu.org, qemu-riscv@nongnu.org
Cc: bmeng.cn@gmail.com, palmer@dabbelt.com, alistair23@gmail.com
Subject: Re: [PATCH v1 1/1] target/riscv/pmp: Add assert for ePMP operations
Date: Fri, 21 May 2021 10:30:52 +0800	[thread overview]
Message-ID: <e5ce3d0a-a50a-0c63-80d0-acfcfbe698a2@c-sky.com> (raw)
In-Reply-To: <ec5f225928eec448278c82fcb1f6805ee61dde82.1621550996.git.alistair.francis@wdc.com>

Reviewed-by: LIU Zhiwei <zhiwei_liu@c-sky.com>

On 5/21/21 6:55 AM, Alistair Francis wrote:
> Although we construct epmp_operation in such a way that it can only be
> between 0 and 15 Coverity complains that we don't handle the other
> possible cases. To fix Coverity and make it easier for humans to read
> add a default case to the switch statement that calls
> g_assert_not_reached().
>
> Fixes: CID 1453108
> Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
> ---
>   target/riscv/pmp.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/target/riscv/pmp.c b/target/riscv/pmp.c
> index 78203291de..82ed020b10 100644
> --- a/target/riscv/pmp.c
> +++ b/target/riscv/pmp.c
> @@ -402,6 +402,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
>                       case 15:
>                           *allowed_privs = PMP_READ;
>                           break;
> +                    default:
> +                        g_assert_not_reached();
>                       }
>                   } else {
>                       switch (epmp_operation) {
> @@ -433,6 +435,8 @@ bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr,
>                       case 7:
>                           *allowed_privs = PMP_READ | PMP_WRITE | PMP_EXEC;
>                           break;
> +                    default:
> +                        g_assert_not_reached();
>                       }
>                   }
>               }



  parent reply	other threads:[~2021-05-21  2:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 22:55 [PATCH v1 1/1] target/riscv/pmp: Add assert for ePMP operations Alistair Francis
2021-05-20 22:55 ` Alistair Francis
2021-05-21  2:17 ` Bin Meng
2021-05-21  2:17   ` Bin Meng
2021-05-21  2:30 ` LIU Zhiwei [this message]
2021-05-21  2:30   ` LIU Zhiwei
2021-05-25 21:53 ` Alistair Francis
2021-05-25 21:53   ` Alistair Francis

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=e5ce3d0a-a50a-0c63-80d0-acfcfbe698a2@c-sky.com \
    --to=zhiwei_liu@c-sky.com \
    --cc=alistair.francis@wdc.com \
    --cc=alistair23@gmail.com \
    --cc=bmeng.cn@gmail.com \
    --cc=palmer@dabbelt.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.