X86 platform drivers
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Fernando Eckhardt Valle (FIPT)" <fevalle@ipt.br>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mark Pearson <mpearson-lenovo@squebb.ca>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"hmh@hmh.eng.br" <hmh@hmh.eng.br>,
	"markgross@kernel.org" <markgross@kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"ibm-acpi-devel@lists.sourceforge.net" 
	<ibm-acpi-devel@lists.sourceforge.net>,
	"platform-driver-x86@vger.kernel.org" 
	<platform-driver-x86@vger.kernel.org>
Subject: Re: [PATCH v4] platform/x86: thinkpad_acpi: sysfs interface to auxmac
Date: Mon, 25 Sep 2023 15:18:56 +0300 (EEST)	[thread overview]
Message-ID: <cc894b7-8513-cd0-f59d-7647541da92@linux.intel.com> (raw)
In-Reply-To: <CPVP152MB50535F32391251E1AF02FA00D8FFA@CPVP152MB5053.LAMP152.PROD.OUTLOOK.COM>

On Fri, 22 Sep 2023, Fernando Eckhardt Valle (FIPT) wrote:

> Thanks for the feedback again!
> 
> > Okay, I wasn't expecting this change as this relies on the nul termination
> > by strscpy() since the original buffer does not have one but the #
> > character there. But I guess it isn't harmful either.
> Yes, precisely because strscpy() put the 'nul terminator' I thought it 
> would be ok. In the tests I did, everything always worked fine too.

It was a bit unorthodox way to take advantage of the way strscpy() works
but like I said, doesn't look harmful.

> >  AUXMAC_START is an offset ??? It should be AUXMAC_LEN.
>
> I thought that since the string 'disabled' has length 8, then I would 
> use AUXMAC_START which is defined as 9 , because that way strscpy would 
> copy the 8 characters of 'disabled' + the nul terminator. Wouldn't that 
> be correct? Or would it be better to use AUXMAC_LEN which is defined to 
> 12? 

strscpy() is takes the size of the destination:

 * @size: Size of destination buffer

...so please use AUXMAC_LEN.

In anycase, "disabled" as the source is itself nul-terminated so strscpy() 
won't copy beyond its length.


-- 
 i.


  reply	other threads:[~2023-09-25 12:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-21 14:36 [PATCH v4] platform/x86: thinkpad_acpi: sysfs interface to auxmac Fernando Eckhardt Valle
2023-09-22  8:51 ` Ilpo Järvinen
2023-09-22 18:21   ` Fernando Eckhardt Valle (FIPT)
2023-09-25 12:18     ` Ilpo Järvinen [this message]
2023-09-26 10:11 ` Hans de Goede

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=cc894b7-8513-cd0-f59d-7647541da92@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=corbet@lwn.net \
    --cc=fevalle@ipt.br \
    --cc=hdegoede@redhat.com \
    --cc=hmh@hmh.eng.br \
    --cc=ibm-acpi-devel@lists.sourceforge.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mpearson-lenovo@squebb.ca \
    --cc=platform-driver-x86@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