Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7886782pxb; Fri, 19 Feb 2021 01:44:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJyde/kyH8f0M0dtXWuRloLrnErgf99xt5xjPiHo64KeFOmE+iRyWIgx75c5q4Bg6nKCvJ74 X-Received: by 2002:aa7:de82:: with SMTP id j2mr8349762edv.313.1613727851199; Fri, 19 Feb 2021 01:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613727851; cv=none; d=google.com; s=arc-20160816; b=GIGkRhyhO72YdZBch81Cl0ed3Hokz1J5Hb6N65YM3I/eTgWaWCawnuK1Ow5diG6hQv mjNz3srt47kjw2YUjxxzUIjLqE1UncAkivr7hm53JoJ3M6ht+qmGzxcq790WZgOHCvEh /lxjp0qTN0ihoKGTVuIoRnCHtnDyFyKypI8sCO4+2r/FmysZ5aN/k0mIoG2mMEM11bLt NBXy8zKLJd+JzYgiEODyvKDIoBs746vKoF175VcNpLg/OonZEcutFbSwBX1+00l7tLxH TGYaum3mDEgLs2MOQ6pL6Dv2kIkVn83fVnaV7IG6Xx9tY0za3UQBi6hC2LOYQ5bItjmb lpmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:cc:to:subject:dkim-signature:dkim-signature; bh=K7HwKjiqoFTB68UR3wV+R7xomRK+Q9QpdnC+ELFTZps=; b=bGKEM9y6aZrRw9TbVamDgCGRK9cymrx+nlV9Ap3zU+OoGHMmQ0S4Tf3Qn0YPjoi/Sc 06he3S4kAF7rhbudyycplAkgDPSzuncnmAdWWtoGusplW5hB1DUFRNNQ0ATe0Jv6Wa5p vN2yr5BLl9szorqosZgl0mKxDae7qGudlvyVkDEaL5KM6r1F5GMjLEj0WSO4C3HJkPG+ v2b2sxuIJwkz0pHjcAPkk6zNp9UZrOpa2tOK81mN8sz3ZFg86QjaeQFz+f5wysfUOusz isPX4TxSN0WS6sC+N5Wjvlk1PI1emx/Aj6W6hxnCtQsMOPdAv2BtSAs67fDwXNLrNx/x hl0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@g001.emailsrvr.com header.s=20190322-9u7zjiwi header.b=lEfK3pru; dkim=pass header.i=@mev.co.uk header.s=20190130-41we5z8j header.b=C8o0tara; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q17si5296382ejd.397.2021.02.19.01.43.46; Fri, 19 Feb 2021 01:44:11 -0800 (PST) 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=@g001.emailsrvr.com header.s=20190322-9u7zjiwi header.b=lEfK3pru; dkim=pass header.i=@mev.co.uk header.s=20190130-41we5z8j header.b=C8o0tara; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229636AbhBSJml (ORCPT + 99 others); Fri, 19 Feb 2021 04:42:41 -0500 Received: from smtp88.iad3b.emailsrvr.com ([146.20.161.88]:33740 "EHLO smtp88.iad3b.emailsrvr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229527AbhBSJmi (ORCPT ); Fri, 19 Feb 2021 04:42:38 -0500 X-Greylist: delayed 630 seconds by postgrey-1.27 at vger.kernel.org; Fri, 19 Feb 2021 04:42:37 EST DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=g001.emailsrvr.com; s=20190322-9u7zjiwi; t=1613727077; bh=S+dJPTKN+EhVQm/f0xJ8YQU7u1kFlh0tuWCSQHpuENE=; h=Subject:To:From:Date:From; b=lEfK3pruzk2zZpa4BZXgeGnwnjIM7Y/46Fl/vxL+TLPnKWBCJplQoVHKiTtWQeybW 4cdUA7KZbSMlzS/7VV+gRm24rydkj/Ozh1CGV2e3oDzbq851iIWViFUOQYrXLqugN3 4GWW5tyQLyBg+08f1WPnAmxZyE/pTXHvNC/2cLKE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mev.co.uk; s=20190130-41we5z8j; t=1613727077; bh=S+dJPTKN+EhVQm/f0xJ8YQU7u1kFlh0tuWCSQHpuENE=; h=Subject:To:From:Date:From; b=C8o0taraGqg6XxLTopMmXgB8CtZj3WjK+ewkvHM4PLSa+tRxcgLJwHBIyM+Igvfav /I7l6zqfcTBb72oN4jGy8wJhS/GToGjp2Sf0ZcsJuhmzU/QncZsXbKMBFoMfxHhKjh Gc2OiY1KtOCxb/8tR6cv4gWIMgZ+IESvgC9yLf80= X-Auth-ID: abbotti@mev.co.uk Received: by smtp4.relay.iad3b.emailsrvr.com (Authenticated sender: abbotti-AT-mev.co.uk) with ESMTPSA id 1ADB52071B; Fri, 19 Feb 2021 04:31:16 -0500 (EST) Subject: Re: [PATCH] staging: comedi: cast to (unsigned int *) To: David Laight , Greg KH , Atul Gopinathan Cc: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" References: <20210217165907.9777-1-atulgopinathan@gmail.com> <20210217181000.GB10124@atulu-ubuntu> <3cfef23d-8d4a-205c-61e8-cbe8c9a0c0f4@mev.co.uk> <21a953261eb44e7ba302cfe74d8efa2d@AcuMS.aculab.com> From: Ian Abbott Organization: MEV Ltd. Message-ID: <94917044-ba8f-7044-42f6-7e8d5ef1e10b@mev.co.uk> Date: Fri, 19 Feb 2021 09:31:16 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <21a953261eb44e7ba302cfe74d8efa2d@AcuMS.aculab.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Classification-ID: 859589ae-0f4d-437d-8685-e5f2ac50e4f5-1-1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 19/02/2021 09:03, David Laight wrote: >> It's kind of moot anyway because the patch is outdated. But the reason >> for the ___force is that the same `struct comedi_cmd` is used in both >> user and kernel contexts. In user contexts, the `chanlist` member >> points to user memory and in kernel contexts it points to kernel memory >> (copied from userspace). > > Can't you use a union of the user and kernel pointers? > (Possibly even anonymous?) > Although, ideally, keeping them in separate fields is better. > 8 bytes for a pointer isn't going make a fat lot of difference. This is for a UAPI header (eventually), so cannot add a new field. For an anonymous union, one tagged with __user and one not, the __user tag would be removed during conversion from UAPI headers to /usr/include/linux headers, leaving a union of two identically typed members, which would look a bit odd. The union also kind of hides the problem. -- -=( Ian Abbott || MEV Ltd. is a company )=- -=( registered in England & Wales. Regd. number: 02862268. )=- -=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=- -=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-