diff mbox

nbd: Fix overflow return value

Message ID 1423722111-12902-1-git-send-email-eric.fangyi@huawei.com
State New
Headers show

Commit Message

Yik Fang Feb. 12, 2015, 6:21 a.m. UTC
The value of reply.error should be the type unsigned int.

Signed-off-by: Yik Fang <eric.fangyi@huawei.com>
---
 nbd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Fam Zheng Feb. 12, 2015, 7:38 a.m. UTC | #1
On Thu, 02/12 06:21, Yik Fang wrote:
> The value of reply.error should be the type unsigned int.
> 
> Signed-off-by: Yik Fang <eric.fangyi@huawei.com>
> ---
>  nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nbd.c b/nbd.c
> index e56afbc1..30e2f3b 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -1295,7 +1295,7 @@ static void nbd_trip(void *opaque)
>      default:
>          LOG("invalid request type (%u) received", request.type);
>      invalid_request:
> -        reply.error = -EINVAL;
> +        reply.error = EINVAL;
>      error_reply:
>          if (nbd_co_send_reply(req, &reply, 0) < 0) {
>              goto out;
> -- 
> 1.8.5
> 

Reviewed-by: Fam Zheng <famz@redhat.com>
Paolo Bonzini March 11, 2015, 11:39 a.m. UTC | #2
On 12/02/2015 07:21, Yik Fang wrote:
> The value of reply.error should be the type unsigned int.
> 
> Signed-off-by: Yik Fang <eric.fangyi@huawei.com>
> ---
>  nbd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/nbd.c b/nbd.c
> index e56afbc1..30e2f3b 100644
> --- a/nbd.c
> +++ b/nbd.c
> @@ -1295,7 +1295,7 @@ static void nbd_trip(void *opaque)
>      default:
>          LOG("invalid request type (%u) received", request.type);
>      invalid_request:
> -        reply.error = -EINVAL;
> +        reply.error = EINVAL;
>      error_reply:
>          if (nbd_co_send_reply(req, &reply, 0) < 0) {
>              goto out;
> 

Applied to my local branch, thanks.

Paolo
diff mbox

Patch

diff --git a/nbd.c b/nbd.c
index e56afbc1..30e2f3b 100644
--- a/nbd.c
+++ b/nbd.c
@@ -1295,7 +1295,7 @@  static void nbd_trip(void *opaque)
     default:
         LOG("invalid request type (%u) received", request.type);
     invalid_request:
-        reply.error = -EINVAL;
+        reply.error = EINVAL;
     error_reply:
         if (nbd_co_send_reply(req, &reply, 0) < 0) {
             goto out;