Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5365949pxv; Wed, 7 Jul 2021 01:55:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdhRCOxcRMd4Z8KMreWxd6SYpJsEnCTkKo8c6VZWjPyj6aHYJdILZqysBdYao/xKXIm0f9 X-Received: by 2002:a50:ee87:: with SMTP id f7mr6732439edr.155.1625648128836; Wed, 07 Jul 2021 01:55:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625648128; cv=none; d=google.com; s=arc-20160816; b=aF3lnt4i5vVGUOsXMHqTyceLkRF2jkc1g7+sW1j0hjERXrrq6R3HQ8GLy3S6tFQfwJ pbssBgixCEW1DiuZbBogfGJnr8YUl1H38QcH+nxfD+r4P3HsFgwd1PhxtLN1MvYXH+rg SsMcQvQjhFEhs0aVWXX4Mvmf9++zlwTPytdePv6EDO+i4HneRbWI69pemIJCk6c9o+3v 0AE9Pid1DsSQ1+pEvcSvjH5h4XXvYnxmKkP9JsoYPz8aCYQKTuIdHZ4BFG/1Ek7mTs5g A3uoojkw4JSXKKwUdkw68ePPzfil4z8eQWUwBTrEFNI8eW0pCPNes+b3qh99+3tBj3cL j0lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=RSGta0qNpB6QcJ/llRMjKtAhvAPIvAnC+iGh3rJx/qg=; b=WjoQN+c80Yx+IZGDEWZ2Sim63PdA2bIIZlXG310zRXqYRsMZdpfi1YywrXrSCYM5XB CMrY54b+JZyi+fmhtw2xUu3pN4Gn8SVt9KLZnM2cRM6Z2b6ykTBbzGk/qymGa7KdID2J WXE5C+vqJvhByYRoJY0OPiXKliZZzqscJn0wPzAmEXmQpEoldvoAqzXDSn3ZSSKyocbe 3+kE+kzz4CgTaANQM21fJlywB2LDZw1q9OF+KU0T01j8SFXwVDt+mb+f16uD15ETkIUi JGeepuS2AbmQD85Lo1QgKi7dYxRPv2hrnElMRo7yOJzsqI/RY5ywa4l4Pk1r/cdM9FUE KtDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hJtnXPMJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l10si7861171ejo.34.2021.07.07.01.55.06; Wed, 07 Jul 2021 01:55:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=hJtnXPMJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231254AbhGGIzp (ORCPT + 99 others); Wed, 7 Jul 2021 04:55:45 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:49795 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230446AbhGGIzo (ORCPT ); Wed, 7 Jul 2021 04:55:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625647984; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RSGta0qNpB6QcJ/llRMjKtAhvAPIvAnC+iGh3rJx/qg=; b=hJtnXPMJIcE5o8NZgK0nnNYUwrB/6eLhIX1CQcKNw/EZqNPt4cXqHG8in8yY7OfXwdXMBD EFxLHaFVFpjcbkSXbtajKDTSiRScTnwz4QbCpTZiB2IlygToNIGPMsyN7ChEM7ITdTNSGy r1dwppbklqiEsBN/O6dKbYXg1Yvoo4w= 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-68-v1nUrO-5Ov24IW-5AspE9w-1; Wed, 07 Jul 2021 04:53:03 -0400 X-MC-Unique: v1nUrO-5Ov24IW-5AspE9w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4831F1800D41; Wed, 7 Jul 2021 08:53:00 +0000 (UTC) Received: from localhost (ovpn-114-152.ams2.redhat.com [10.36.114.152]) by smtp.corp.redhat.com (Postfix) with ESMTP id A3E7719C44; Wed, 7 Jul 2021 08:52:55 +0000 (UTC) Date: Wed, 7 Jul 2021 09:52:54 +0100 From: Stefan Hajnoczi To: Xie Yongji Cc: mst@redhat.com, jasowang@redhat.com, sgarzare@redhat.com, parav@nvidia.com, hch@infradead.org, christian.brauner@canonical.com, rdunlap@infradead.org, willy@infradead.org, viro@zeniv.linux.org.uk, axboe@kernel.dk, bcrl@kvack.org, corbet@lwn.net, mika.penttila@nextfour.com, dan.carpenter@oracle.com, joro@8bytes.org, gregkh@linuxfoundation.org, songmuchun@bytedance.com, virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 09/10] vduse: Introduce VDUSE - vDPA Device in Userspace Message-ID: References: <20210615141331.407-1-xieyongji@bytedance.com> <20210615141331.407-10-xieyongji@bytedance.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="FCq4Eu07/ej1hAmI" Content-Disposition: inline In-Reply-To: <20210615141331.407-10-xieyongji@bytedance.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --FCq4Eu07/ej1hAmI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 15, 2021 at 10:13:30PM +0800, Xie Yongji wrote: > +static bool vduse_validate_config(struct vduse_dev_config *config) > +{ The name field needs to be NUL terminated? > + case VDUSE_CREATE_DEV: { > + struct vduse_dev_config config; > + unsigned long size = offsetof(struct vduse_dev_config, config); > + void *buf; > + > + ret = -EFAULT; > + if (copy_from_user(&config, argp, size)) > + break; > + > + ret = -EINVAL; > + if (vduse_validate_config(&config) == false) > + break; > + > + buf = vmemdup_user(argp + size, config.config_size); > + if (IS_ERR(buf)) { > + ret = PTR_ERR(buf); > + break; > + } > + ret = vduse_create_dev(&config, buf, control->api_version); > + break; > + } > + case VDUSE_DESTROY_DEV: { > + char name[VDUSE_NAME_MAX]; > + > + ret = -EFAULT; > + if (copy_from_user(name, argp, VDUSE_NAME_MAX)) > + break; Is this missing a NUL terminator? --FCq4Eu07/ej1hAmI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAmDla2YACgkQnKSrs4Gr c8iwDwgAklDinwoNdcTKlrJAeuzd7lkg6g0pp6GgPOoSoPbIEzizyjezLIi98oHV vF5TkSJ9SmhwrTkrfniJQf7czNd+oWvB/PeLW+YOTNYnHkS4AlS4z4/Z48sAiees bjx0y6rK8AKEd1d2F5lOEbHr1hyPAEuA5j1trgrHzaUhKLKiRfCYQI0mJIaWYUTT 5AJ6lKidGWNOayzU4/GQ+PfEPahMie3/T2g+ivR4j0E6YLNvJs7CFFerZYRNGLXQ D5MqzXxvgHF75J7QuXmOOYTRhRMzWoYI4K6EfwzZJHWIJrBhVeXogKJ0Z4tnp82W f66VauRbMPZNCJ5g0gXGzczBzlXh0A== =aR1n -----END PGP SIGNATURE----- --FCq4Eu07/ej1hAmI--