Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2927362pxb; Fri, 12 Feb 2021 05:15:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxFPXuYUjvzVyTeJ23xLQB2H9XF21SPNH1VGxXZ27jikmD7AS5zLXUHQQhGCvzjNFm5IK+M X-Received: by 2002:aa7:ca13:: with SMTP id y19mr3314492eds.300.1613135732629; Fri, 12 Feb 2021 05:15:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613135732; cv=none; d=google.com; s=arc-20160816; b=lD/TyNA1JOVCZkN+oV3CgTqbJiUNr+OU2MRhZbdWy5e4GKMq/HT7QbjeBKqNRbpS26 ga3X1C/EQHqUwq84MMHkKOpa3tYo8hIfZt52OVsjM8uitAfbEHEFB84Z+PTgaS4inXvu L69n8lcIHwgDWGH1NBGTPpKvMT5FCfhxjIZzZdjPmiyULj426B1YX/Dgyn5HxGdzDLRB kuNqc0xQAeoD/TavX767+ZB4M12Gbn7EFFZcauPna4FKf2f/aUNDqHKQKAcfQQkmphMO 74tSG/fKv0tp+t4a5PJnQUOrg386x7QXSFShEIolidQ/TzABvkYnkuSUzqeLaHW3oXbu CQWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=mB82SPJ4sUvAP/MTxvyjnaDxWnUMLJPL3SryNf3taAk=; b=pcUDaZGW53r37QinWoLQr9sPq+H9Mayouq2AFc02TNb+LQL18xFidk31Iv0hOCQtHb eO8wDNw4PWmdDzvUtNdAA69MrgAvBxmpXUyDp9NPfPY59N5kbKNsnK8pJ1v1T7aBC4wb KNalVxVIwkBC1WQSpN3Vrc0nsJNKUa3WmzPrjNrlJYDAD1Lv6DSkP1RVGiIliMIk50bI VstApHEBTU+g0r1ZIyh+yv7tDjnJx8uTOIsDY3dEnVWZViDQi5INQq89stqC5e/Tzi3I 3Azq6wURBM5k5D6mP2D2LusuCcItSinRlPK4aAd/E8IQuR0HNkT9fyHnXhAOHz+U2VSr sMmg== ARC-Authentication-Results: i=1; mx.google.com; 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 g24si6240880edh.82.2021.02.12.05.15.09; Fri, 12 Feb 2021 05:15:32 -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; 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 S231364AbhBLNMU (ORCPT + 99 others); Fri, 12 Feb 2021 08:12:20 -0500 Received: from mail-ot1-f52.google.com ([209.85.210.52]:34060 "EHLO mail-ot1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231992AbhBLM6R (ORCPT ); Fri, 12 Feb 2021 07:58:17 -0500 Received: by mail-ot1-f52.google.com with SMTP id y11so8285942otq.1; Fri, 12 Feb 2021 04:58:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mB82SPJ4sUvAP/MTxvyjnaDxWnUMLJPL3SryNf3taAk=; b=YZ/i4MmMCTmxQ04u7TvYVt4ToDrKDc9ERUy1pht4dj5x89rN9z4N6VIArZlwlP2mL0 wrV3Ds5RtB19n7Xu6nkqX+l9R+jP144fr+Ras0gh6Z5VOET7cqyWyKjtat8w+NYrskLC R2J0FXVRoqGCJpcBMiTN8RItHkgl4kPZxQFrrtTZ012TOO/aJGBtKRpp8JbsyaQVqLHF a4cHiSv1/fl766HYtKs4lXt9kJuioggq7+nyect5uCEYpGRCR4HLh/MMdUyZfTBDgio1 Bmx2Klfrg31vAmiuxLbOduUxZPBBsoI0bxsPVhW64tQtgyy2RyicAjcZ807IfN8I3fPi Iopw== X-Gm-Message-State: AOAM5321UlgBSZH5SjgfzrE6wnWje6/uYuAHMk3GPUfTcf3bCjcuNKG5 mnN0EP56n6uv58eMjlv3ABnI5RVeYZMDqstDI00= X-Received: by 2002:a9d:77d6:: with SMTP id w22mr1866225otl.145.1613134656073; Fri, 12 Feb 2021 04:57:36 -0800 (PST) MIME-Version: 1.0 References: <20210211180820.25757-1-nsaenzjulienne@suse.de> <20210212123118.GB6057@sirena.org.uk> <20210212125221.GD6057@sirena.org.uk> In-Reply-To: <20210212125221.GD6057@sirena.org.uk> From: Geert Uytterhoeven Date: Fri, 12 Feb 2021 13:57:24 +0100 Message-ID: Subject: Re: [PATCH] spi: Skip zero-length transfers in spi_transfer_one_message() To: Mark Brown Cc: Nicolas Saenz Julienne , Robin Murphy , Phil Elwell , linux-spi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, On Fri, Feb 12, 2021 at 1:55 PM Mark Brown wrote: > On Fri, Feb 12, 2021 at 01:48:21PM +0100, Nicolas Saenz Julienne wrote: > > On Fri, 2021-02-12 at 12:31 +0000, Mark Brown wrote: > > > On Thu, Feb 11, 2021 at 07:08:20PM +0100, Nicolas Saenz Julienne wrote: > > > > > - if (xfer->tx_buf || xfer->rx_buf) { > > > > + if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) { > > > > I think the issue here is more that some users were passing in buffers > > > with zero length transfers, the above check was already intended to > > > catch this case but was working on the assumption that if there was > > > nothing to transfer then no buffer would be provided. > > > Fair enough, maybe it makes sense to move the check into __spi_validate() and > > propagate an error upwards? > > No, I think it's fine - there's probably some sensible use case with > drivers reusing a statically allocated transfer/buffer set for multiple > operations and just tweaking the length as needed which seems a bit > weird but I can't think of a reason not to allow it. Your patch is > currently queued, all being well it'll get tested & pushed out later > today. Aren't the zero-length transfers also used to do tricks with the CS signal, e.g. combined with cs_change? Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds