From patchwork Fri Feb 14 08:01:00 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 11381845 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AD382921 for ; Fri, 14 Feb 2020 08:01:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8B4A620675 for ; Fri, 14 Feb 2020 08:01:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="i+eY5lEB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8B4A620675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 48CDA6E4F4; Fri, 14 Feb 2020 08:01:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4225D6E4F4 for ; Fri, 14 Feb 2020 08:01:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1581667268; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=40VP33gu2neJNp1TOhQHNjH0xuCUDhYDqToHmrgnVbw=; b=i+eY5lEBq9/YWot8u/zOD4gq98Php3D+Gk/kSH05acuevySPz5iUytunUhdcGB/kLDGkk0 DFLtIzscnyZot/MUFIrc3QEzeun+GQ7BUbwz+MmP6bnUuUKhWnXkQzkvyRtlGnoe7M1yxz RjFFE4ofo3TufMadL4DtUAPzZzsj8Ro= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-319-CvIYS2qUOgyUWJS3UebuyA-1; Fri, 14 Feb 2020 03:01:06 -0500 X-MC-Unique: CvIYS2qUOgyUWJS3UebuyA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5CD1113E2; Fri, 14 Feb 2020 08:01:04 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-117-39.ams2.redhat.com [10.36.117.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3391988854; Fri, 14 Feb 2020 08:01:01 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6DEC3939B; Fri, 14 Feb 2020 09:01:00 +0100 (CET) From: Gerd Hoffmann To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/virtio: fix error check Date: Fri, 14 Feb 2020 09:01:00 +0100 Message-Id: <20200214080100.1273-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , smitterl@redhat.com, cohuck@redhat.com, open list , gurchetansingh@chromium.org, Gerd Hoffmann , "open list:VIRTIO GPU DRIVER" MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The >= compare op must happen in cpu byte order, doing it in little endian fails on big endian machines like s390. Reported-by: Sebastian Mitterle Signed-off-by: Gerd Hoffmann Reviewed-by: Cornelia Huck --- drivers/gpu/drm/virtio/virtgpu_vq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/virtio/virtgpu_vq.c b/drivers/gpu/drm/virtio/virtgpu_vq.c index cfe9c54f87a3..67caecde623e 100644 --- a/drivers/gpu/drm/virtio/virtgpu_vq.c +++ b/drivers/gpu/drm/virtio/virtgpu_vq.c @@ -222,7 +222,7 @@ void virtio_gpu_dequeue_ctrl_func(struct work_struct *work) trace_virtio_gpu_cmd_response(vgdev->ctrlq.vq, resp); if (resp->type != cpu_to_le32(VIRTIO_GPU_RESP_OK_NODATA)) { - if (resp->type >= cpu_to_le32(VIRTIO_GPU_RESP_ERR_UNSPEC)) { + if (le32_to_cpu(resp->type) >= VIRTIO_GPU_RESP_ERR_UNSPEC) { struct virtio_gpu_ctrl_hdr *cmd; cmd = virtio_gpu_vbuf_ctrl_hdr(entry); DRM_ERROR_RATELIMITED("response 0x%x (command 0x%x)\n",