Linux Input/HID development
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <sergeantsagara@protonmail.com>
To: "Guilherme G. Piccoli" <gpiccoli@igalia.com>
Cc: jikos@kernel.org, djogorchock@gmail.com,
	linux-input@vger.kernel.org, benjamin.tissoires@redhat.com,
	kernel@gpiccoli.net, kernel-dev@igalia.com
Subject: Re: [PATCH] HID: nintendo: Prevent divide-by-zero on code
Date: Mon, 18 Dec 2023 21:56:07 +0000	[thread overview]
Message-ID: <87y1dr89an.fsf@protonmail.com> (raw)
In-Reply-To: <dcd91e66-11ce-c576-5eb7-8756a1b6f222@igalia.com>

On Mon, 18 Dec, 2023 18:46:09 -0300 "Guilherme G. Piccoli" <gpiccoli@igalia.com> wrote:
>
> Hi Rahul, thanks for your review.
>
> I think I see ... I covered both bases in this patch, but IIUC after
> your points above and better looking the code:
>
> (a) imu_avg_delta_ms is set to JC_IMU_DFLT_AVG_DELTA_MS and it can only
> change iff imu_delta_samples_count >= JC_IMU_SAMPLES_PER_DELTA_AVG.
>
> (b) But the if path related with the imu_delta_samples_count is the one
> that also guards the divide-by-zero, so effectively that error condition
> cannot happen outside that if path, i.e., my hunk changed nothing.
> Ugh...my bad.

Right, no worries. I really appreciate this patch though for covering
the cases involving the gyro and the accelerometer.

>
> At the same time, the hunk is harmless - it's up to Jiri to decide, we
> can drop it (either directly by git rebasing or I can send a V2 if Jiri
> prefers), or we can keep it.

Agreed.

>
> I can try to test internally, github testing may be a bit uncertain in
> the timeframe (specially during holidays season). If Jiri thinks the
> hunk is harmless and no change is necessary, I'd rather not bother
> people for testing now (I don't have the HW).
>

Makes sense. Like discussed above, the change here is harmless in nature
but has no functional change at the same time.

--
Thanks,

Rahul Rameshbabu


  reply	other threads:[~2023-12-18 21:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-05 21:15 [PATCH] HID: nintendo: Prevent divide-by-zero on code Guilherme G. Piccoli
2023-12-18 15:50 ` Jiri Kosina
2023-12-18 19:22   ` Guilherme G. Piccoli
     [not found]     ` <CACC3sbFGHHONh=orX2+VuRu1SdGXu-jhhFVE-xZe1wOBodUzpQ@mail.gmail.com>
2023-12-18 19:47       ` Jiri Kosina
2023-12-18 20:39 ` Rahul Rameshbabu
2023-12-18 21:46   ` Guilherme G. Piccoli
2023-12-18 21:56     ` Rahul Rameshbabu [this message]
2023-12-18 22:27     ` Jiri Kosina
2023-12-18 23:29       ` Guilherme G. Piccoli
2023-12-18 23:49         ` Jiri Kosina
2023-12-19  0:03           ` Guilherme G. Piccoli

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=87y1dr89an.fsf@protonmail.com \
    --to=sergeantsagara@protonmail.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=djogorchock@gmail.com \
    --cc=gpiccoli@igalia.com \
    --cc=jikos@kernel.org \
    --cc=kernel-dev@igalia.com \
    --cc=kernel@gpiccoli.net \
    --cc=linux-input@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox