From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756192AbcDDSrn (ORCPT ); Mon, 4 Apr 2016 14:47:43 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:54577 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755443AbcDDSrm (ORCPT ); Mon, 4 Apr 2016 14:47:42 -0400 Date: Mon, 4 Apr 2016 19:47:36 +0100 From: Al Viro To: Christoph Hellwig Cc: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Subject: Re: [RFC] weird semantics of SG_DXFER_TO_FROM_DEV in BLK_DEV_SKD (drivers/block/skd*) Message-ID: <20160404184736.GG17997@ZenIV.linux.org.uk> References: <20160404033845.GE17997@ZenIV.linux.org.uk> <20160404065220.GA9447@infradead.org> <20160404171611.GF17997@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160404171611.GF17997@ZenIV.linux.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 04, 2016 at 06:16:12PM +0100, Al Viro wrote: > will see NULL map_data; the ->from_user case is sg_start_req() stuff. IOW, > SG_IO behaviour for /dev/sg* is different from the generic one... While we are at it: in bio_map_user_iov() we have iov_for_each(iov, i, *iter) { unsigned long uaddr = (unsigned long) iov.iov_base; unsigned long len = iov.iov_len; unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; unsigned long start = uaddr >> PAGE_SHIFT; /* * Overflow, abort */ if (end < start) return ERR_PTR(-EINVAL); nr_pages += end - start; /* * buffer must be aligned to at least hardsector size for now */ if (uaddr & queue_dma_alignment(q)) return ERR_PTR(-EINVAL); } Do we only care about the iov_base alignment? IOW, shouldn't we check for iov_len being a multiple of queue_dma_alignment(q) as well?