All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee@kernel.org>
To: Jiri Kosina <jikos@kernel.org>
Cc: benjamin.tissoires@redhat.com, avid.rheinsberg@gmail.com,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org
Subject: Re: [PATCH 1/2] HID: core: Provide new max_buffer_size attribute to over-ride the default
Date: Wed, 18 Jan 2023 11:09:43 +0000	[thread overview]
Message-ID: <Y8fTd0VJXqKkPIuo@google.com> (raw)
In-Reply-To: <nycvar.YFH.7.76.2301181002550.1734@cbobk.fhfr.pm>

On Wed, 18 Jan 2023, Jiri Kosina wrote:

> On Fri, 13 Jan 2023, Lee Jones wrote:
> 
> > Presently, when a report is processed, its size is compared solely 
> > against the value specified by user-space.  
> 
> While I am generally fine with the idea, I don't understand this sentence. 
> What exactly do you mean by 'specified by user-space'? It's defined as a 
> compile-time constant.
> 
> > If the received report ends up being smaller than this, the
> > remainder of the buffer is zeroed. 

Apologies for any ambiguity.

"its size" == "compile-time constant"

Would "its maximum size" read better?

These sentences are an attempt to describe this statement:

    if (csize < rsize) {
        dbg_hid("report %d is too short, (%d < %d)\n", report->id,
            csize, rsize);
        memset(cdata + csize, 0, rsize - csize);
    }

Where csize is "the [size of the] received report" and rsize is the
"value [size] specified by user-space".  Thus, if user-space says the
report will be 8-Bytes (rsize) and it actually only only submits 6-Bytes
(csize), then the subsystem will complain that the "report is too short"
and it will attempt to zero the seemingly unused 2-Bytes.

-- 
Lee Jones [李琼斯]

  reply	other threads:[~2023-01-18 11:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-13 15:05 [PATCH 1/2] HID: core: Provide new max_buffer_size attribute to over-ride the default Lee Jones
2023-01-13 15:05 ` [PATCH 2/2] HID: uhid: Over-ride the default maximum data buffer value with our own Lee Jones
2023-01-18  9:03 ` [PATCH 1/2] HID: core: Provide new max_buffer_size attribute to over-ride the default Jiri Kosina
2023-01-18 11:09   ` Lee Jones [this message]
2023-01-18 14:55     ` Jiri Kosina
2023-01-18 15:11       ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8fTd0VJXqKkPIuo@google.com \
    --to=lee@kernel.org \
    --cc=avid.rheinsberg@gmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.