mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ilya Matveychikov <matvejchikov@gmail.com>
To: Ben Hutchings <ben.hutchings@codethink.co.uk>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/3] Introduce kernel small arrays (KSA)
Date: Wed, 18 Oct 2017 16:41:26 +0400	[thread overview]
Message-ID: <F307C855-B4DF-4641-B85D-76F74F08C918@gmail.com> (raw)
In-Reply-To: <1507130554.26687.8.camel@codethink.co.uk>


> On Oct 4, 2017, at 7:22 PM, Ben Hutchings <ben.hutchings@codethink.co.uk> wrote:
> 
> On Tue, 2017-09-19 at 12:30 +0400, Ilya Matveychikov wrote:
>> Hi guys,
>> 
>> Please review the approach of using small fixed-sized arrays to improve
>> parsing of values like get_options() does.
>> 
>> This comes to me after fixing an overflow in get_options(). See the thread
>> for details: https://lkml.org/lkml/2017/5/22/581
>> 
>> If the approach is OK I’ll suggest to replace all of get_options() calls
>> to ksa_parse_ints() and remove get_options() at all.
> 
> You didn't cc the patches to me, and I can't find patch 3/3 at all.

Thanks for you answer. I posted them on list, except the last one as what I
wanted is to get the feedback first. I CC’d you as you found a problem with
my patch for get_options() before (read out of bounds).

> 
>  don't think the KSA() macro should be casting its argument.  Where the
> cast is necessary, it ought to be explicit in the caller.

KSA(x) it’s just a simple way to cast from custom-defined small array
to generic one. Do you think that it’s better to use explicit casting:

ksa_parse_foo(..., (struct ksmall_array *)&my_custom_ksa)

Instead of:

ksa_parse_foo(..., KSA(&my_custom_ksa))

Not sure...

> 
> Similarly I think the BUILD_BUG_ON() in ksa_build_check() doesn't belong
> there, but in whichever caller of ksa_parse_ints() requires struct
> ksmall_array to have the same layout as a simple array of unsigned int.

Not sure that I understand your point. The purpose of ksa_build_check() as
I wrote it is to to do compile-time check for sizeof(struct ksmall_array)
to fit sizeof(unsigned int). Note that ksmall_array{} is the header for any
possible “small” array build by using the KSA_DECLARE() macro.

      reply	other threads:[~2017-10-18 12:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19  8:30 Ilya Matveychikov
2017-09-19  8:31 ` [RFC PATCH 1/3] ksmall_array: introduce kernel small arrays Ilya Matveychikov
2017-09-19  8:32 ` [RFC PATCH 2/3] net/dev/core.c: use ksa_parse_ints instead of get_options Ilya Matveychikov
2017-10-04 15:22 ` [RFC PATCH 0/3] Introduce kernel small arrays (KSA) Ben Hutchings
2017-10-18 12:41   ` Ilya Matveychikov [this message]

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=F307C855-B4DF-4641-B85D-76F74F08C918@gmail.com \
    --to=matvejchikov@gmail.com \
    --cc=ben.hutchings@codethink.co.uk \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome