Linux kernel staging patches
 help / color / mirror / Atom feed
From: Ian Abbott <abbotti@mev.co.uk>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev,
	H Hartley Sweeten <hsweeten@visionengravers.com>,
	"Spencer E . Olson" <olsonse@umich.edu>
Subject: Re: [PATCH 0/5] staging: comedi: tests: Fix various issues
Date: Wed, 14 Apr 2021 18:24:19 +0100	[thread overview]
Message-ID: <a09c77de-488a-3c2d-1ea7-82d3a8ef507f@mev.co.uk> (raw)
In-Reply-To: <20210414132818.GF6048@kadam>

On 14/04/2021 14:28, Dan Carpenter wrote:
> On Wed, Apr 14, 2021 at 01:34:23PM +0100, Ian Abbott wrote:
>>> drivers/staging/comedi/drivers/ni_routes.c:61 ni_find_route_values() warn: 'device_family' sometimes too small '8,11' size = 30
>>>      59          for (i = 0; ni_all_route_values[i]; ++i) {
>>>      60                  if (memcmp(ni_all_route_values[i]->family, device_family,
>>>                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>>>      61                             strnlen(device_family, 30)) == 0) {
>>>                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
>>> This whole memcmp() is very strange.  Why not just use:
>>>
>>> 	if (strncmp(ni_all_route_values[i]->family, device_family, 30) == 0)
>>
>> I think even a simple strcmp() would do as well because all the device
>> family strings and board name strings are null terminated.  I don't know why
>> the magic number 30 is used here!
>>
>> The above applies similarly to ni_find_valid_routes() too.
>>
> 
> I was thinking maybe ni_all_route_values[i]->family has an additional
> string on the end.  For example, it could end in "_bar" and we want
> ->family "foo_bar" to match with device_family "foo"?

That doesn't seem to be the case.  The family names are just string
literals pointed to by the 'family' member of 'struct
family_route_values' in
".../comedi/drivers/ni_routing/ni_route_values.h".  Instances of 'struct
family_route_values' are statically defined in
".../comedi/drivers/ni_routing/ni_route_values/*.c".

-- 
-=( Ian Abbott <abbotti@mev.co.uk> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-

  parent reply	other threads:[~2021-04-14 19:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-07 14:01 [PATCH 0/5] staging: comedi: tests: Fix various issues Ian Abbott
2021-04-07 14:01 ` [PATCH 1/5] staging: comedi: tests: ni_routes_test: Fix compilation error Ian Abbott
2021-04-07 14:01 ` [PATCH 2/5] staging: comedi: tests: ni_routes_test: Put complex values in parentheses Ian Abbott
2021-04-07 14:01 ` [PATCH 3/5] staging: comedi: tests: ni_routes_test: Avoid CamelCase: <RVi> Ian Abbott
2021-04-07 15:23   ` Spencer Olson
2021-04-07 14:01 ` [PATCH 4/5] staging: comedi: tests: ni_routes_test: Lines should not end with a '(' Ian Abbott
2021-04-07 14:01 ` [PATCH 5/5] staging: comedi: tests: Correct unittest_fptr Ian Abbott
2021-04-07 15:10 ` [PATCH 0/5] staging: comedi: tests: Fix various issues Greg Kroah-Hartman
2021-04-07 15:39   ` Ian Abbott
2021-04-07 15:48     ` Spencer Olson
2021-04-07 16:16       ` Ian Abbott
2021-04-07 17:26     ` Greg Kroah-Hartman
2021-04-07 18:20       ` Ian Abbott
2021-04-08  7:27         ` Greg Kroah-Hartman
2021-04-14 10:09       ` Dan Carpenter
2021-04-14 10:40         ` Ian Abbott
2021-04-14 12:34         ` Ian Abbott
2021-04-14 13:28           ` Dan Carpenter
2021-04-14 13:57             ` Spencer Olson
2021-04-14 17:24             ` Ian Abbott [this message]
2021-04-14 14:29           ` Spencer Olson
2021-04-14 17:05             ` Ian Abbott
2021-04-15  9:57           ` Ian Abbott
2021-04-14 12:40         ` Ian Abbott
2021-04-14 13:12           ` Greg Kroah-Hartman
2021-04-14 13:30           ` Dan Carpenter
2021-04-07 15:43 ` Spencer Olson

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=a09c77de-488a-3c2d-1ea7-82d3a8ef507f@mev.co.uk \
    --to=abbotti@mev.co.uk \
    --cc=dan.carpenter@oracle.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-staging@lists.linux.dev \
    --cc=olsonse@umich.edu \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).