public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Ayman Bagabas <ayman.bagabas@gmail.com>
Cc: Darren Hart <dvhart@infradead.org>,
	Andy Shevchenko <andy@infradead.org>,
	Takashi Iwai <tiwai@suse.de>, Mattias Jacobsson <2pi@mok.nu>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] platform/x86: huawei-wmi: make validation stricter in huawei_wmi_battery_set()
Date: Tue, 15 Oct 2019 15:46:23 +0300	[thread overview]
Message-ID: <20191015124623.GF21344@kadam> (raw)
In-Reply-To: <CAB3uXr63uUwxBjkeeoftZ6HYm_hmN+E5EUhu15_Mta2qruOugA@mail.gmail.com>

On Tue, Oct 15, 2019 at 08:21:59AM -0400, Ayman Bagabas wrote:
> Hi Dan
> 
> On Tue, Oct 15, 2019, 4:39 AM Dan Carpenter <dan.carpenter@oracle.com>
> wrote:
> 
> > I don't think it makes sense for "end" to be negative or for even for it
> > to be less than "start".  That also means that "start" can't be more
> > than 100 which is good.
> >
> 
> While this makes sense, you run into issues where you cannot set "start"
> before "end" and vice versa.
> 
> Take this scenario, you have start=70 and end=90, now you want to set these
> to start=40 and end=60, you would have to set "start" first before you can
> change the value of "end" otherwise you will run into EINVAL. Now imagine
> you wanna go the opposite direction, you would have to set "end" before you
> can change "start".
> I think having a little wiggle room is fine for such scenarios.
> 

I haven't tested this code...  What you're describing sounds really
very weird to me, but I will accept that you know more about your
use cases than I do.

My other concern is that right now you can set start > 100 or end < 0.

regards,
dan carpenter


  parent reply	other threads:[~2019-10-15 12:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  8:38 [PATCH] platform/x86: huawei-wmi: make validation stricter in huawei_wmi_battery_set() Dan Carpenter
     [not found] ` <CAB3uXr63uUwxBjkeeoftZ6HYm_hmN+E5EUhu15_Mta2qruOugA@mail.gmail.com>
2019-10-15 12:46   ` Dan Carpenter [this message]
2019-10-15 13:20     ` ayman.bagabas

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=20191015124623.GF21344@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=2pi@mok.nu \
    --cc=andy@infradead.org \
    --cc=ayman.bagabas@gmail.com \
    --cc=dvhart@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=tiwai@suse.de \
    /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