Received: by 10.223.185.116 with SMTP id b49csp946909wrg; Fri, 16 Feb 2018 09:43:04 -0800 (PST) X-Google-Smtp-Source: AH8x227BimAkCaRrKuQvNkK1b0HAWnT7l6fnvtm2xEFi1AFWoNw+MUDfzvHorbbw2WPNEBugFsYe X-Received: by 10.99.111.130 with SMTP id k124mr1277915pgc.76.1518802984287; Fri, 16 Feb 2018 09:43:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518802984; cv=none; d=google.com; s=arc-20160816; b=ETe2DScO5LduXxUvr8M4KEpsSvuhcQN5Y5/YvW0tIcPISRh6bGupOuFwGEYkTFNGOC 0gpA59/VR0XY3bMn5Ph3+RSc2/wbs+289aIyrZ77NYgk14b5M1Sp77hyS+x4u+dYQKaV 1/hjom165JnvUaznfv2wZ+cAPKJlFoqAnsfT/k9L0ZZBRKYVgRAMgWdSVT3lkNA923/2 VNiSrYh3k/K9hvcHrgyjos/FhkJo5ErGfND1AYUlIMvm0qzJrUMgtV8MOLYjQEomvJ7j 0KM+SayKhOIWFoO/7bmfSKcd/LRN/rp8VJa502UvIom6gYM3pCQU4lVwQLGbN02s8fYN 51KQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=mNx88gUQtFdPdnfe23uCdEYyJuz0kZvquRXKrN4q8GI=; b=UbDkyEqhpdeFb0DE3XFI0LKiEO3hh/GfTZvZl8+p15PbjEsV93wyR0JEvfonwNwBzT 2fehfO+fnXV1SEG63qxFjG0NEpZxS5TcTEytBE2etXNNFcxodrJkG4Wz6KgkWE62WGP7 3sfaUg35Z50r/v+vq89r3NG8H2NewXnpWQ75gl3wEkB9azHLavDqyPHDpQccnBLVJcQ5 eGTgfsNzWFPyGsRA5sek7uiFRpwwlKaAKh/Pi5GL378pRrTRxjuG2VyjBCw+EmOjuhxi RM1izvRGt15AjFkCgPW8BvonUDxBwn3UXRx2ACzvUUohs0plPdnUbZiDGujWhKO4lqkQ 1tXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohMwzRJS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v66si155145pgv.667.2018.02.16.09.42.50; Fri, 16 Feb 2018 09:43:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ohMwzRJS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163900AbeBOWQm (ORCPT + 99 others); Thu, 15 Feb 2018 17:16:42 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:51782 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752862AbeBOWQi (ORCPT ); Thu, 15 Feb 2018 17:16:38 -0500 Received: by mail-wm0-f68.google.com with SMTP id r71so3596548wmd.1; Thu, 15 Feb 2018 14:16:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mNx88gUQtFdPdnfe23uCdEYyJuz0kZvquRXKrN4q8GI=; b=ohMwzRJS847yXV6w2M7qUUVp+zO9agiDsBq7UpIvW69vyJVkohdOQjKSWmNFvyME++ OmCQY9wnEeRj9zzexhI7vIz0vrZ8JU2zKgFraHK33xVu3frhWMzEOtKcwA4ZUje98Bu6 4Psc0MdzeMLQfSZb+Pa+4OmnqfToqmQ8FZIMV6z8QwT0GQPywBc8FaaDVD9CB7f92xqd 72pLM7yCcGSHdHp0upeLluNXDM2aZAWUP2EaNktOikMnMvpd4tT2PhR2xSns5RLFRYag lqmEyMbqYuUNnd1lpuK3U9nHZQRIu4PEfDxgGd/tselWf3Ln3kblcMpTHAdop8la6ddD VYRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mNx88gUQtFdPdnfe23uCdEYyJuz0kZvquRXKrN4q8GI=; b=mJLlGzySIziRqqbBJTjpe/lm5wOF+OUIK+n+Zbkrw3xvzm/uMvwce+a5Rk79a6WSnz LN+I5hXQUzoRCEaAaeaehg3uPBsnxrXk1DkrbkMH/MVrBDdd7enZQNwpOofk8EgV1+B/ b29BjECiQsY9Ofd2tFH7XvMMMhzXlXF0UXn8TRcsw60eKGt2Nho5cRdU7nC34c4xKtop MNXHPjCpSh3KliJ8PlLDAKoO9IB5gCf0bmkRse5IfPxOxPMwMXKfo2fGbZUMZ1amvJrh y+ggzamra5Pq4xDOWYSwIswN3IOGlZU1GzOUyXX0k5ak3YTPuiCU7Ppa/8bMK3pWCW6r Kgfg== X-Gm-Message-State: APf1xPAjuRvV9vhEXVs2vuL1uQhT3djD/FDTysSirDd70QKiWu7GgeaN lkE7BOhhySdEO9Cn6NRBGEToznHwE9w= X-Received: by 10.28.51.6 with SMTP id z6mr3138818wmz.26.1518732996912; Thu, 15 Feb 2018 14:16:36 -0800 (PST) Received: from casa ([2a01:c50e:5126:7a00:4dc5:23c5:d72:18]) by smtp.gmail.com with ESMTPSA id p5sm17401145wmf.13.2018.02.15.14.16.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 15 Feb 2018 14:16:36 -0800 (PST) Date: Thu, 15 Feb 2018 23:16:33 +0100 From: Rodrigo Rivas Costa To: Benjamin Tissoires Cc: Jiri Kosina , lkml , linux-input@vger.kernel.org Subject: Re: [PATCH 2/3] HID: steam: add serial number information. Message-ID: <20180215221633.GA18755@casa> References: <20180213120308.23879-1-rodrigorivascosta@gmail.com> <20180213120308.23879-2-rodrigorivascosta@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.3 (2018-01-21) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 14, 2018 at 03:51:31PM +0100, Benjamin Tissoires wrote: > On Tue, Feb 13, 2018 at 1:03 PM, Rodrigo Rivas Costa > > +#define STEAM_FEATURE_REPORT_SIZE 65 > > + > > +static int steam_send_report(struct steam_device *steam, > > + u8 *cmd, int size) > > +{ > > + int retry; > > + int ret; > > + u8 *buf = kzalloc(STEAM_FEATURE_REPORT_SIZE, GFP_KERNEL); > > Please use hid_alloc_report_buf() as sometimes we need to allocate a > slightly bigger report. I have an issue with this one. The problem is that using hid_report_len() on the feature report returns 64. But I must call hid_hw_raw_request() with 65 or it will fail with EOVERFLOW. Currently I'm allocating a buffer of 65 bytes and all is well. If I change to hid_alloc_report_buf(), the current implementation allocates (64+7), so I'm still safe. But I'm worried that the extra bytes are not guaranteed and a future implementation could return exactly 64 bytes, leaving me 1 byte short. About why an array of 65 is required for a report of size 64, I think it is related to hid_report->id == 0 (so hid_report_enum->numbered == 0). So what would be the proper solution? Thanks. Rodrigo.