* [PATCH] solo6x10: use designated initializers
@ 2016-12-17 1:05 Kees Cook
2016-12-19 19:56 ` Andrey Utkin
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2016-12-17 1:05 UTC (permalink / raw)
To: linux-kernel
Cc: Bluecherry Maintainers, Andrey Utkin, Ismael Luceno,
Mauro Carvalho Chehab, linux-media
Prepare to mark sensitive kernel structures for randomization by making
sure they're using designated initializers. These were identified during
allyesconfig builds of x86, arm, and arm64, with most initializer fixes
extracted from grsecurity.
Signed-off-by: Kees Cook <keescook@chromium.org>
---
drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
index 6a35107aca25..36e93540bb49 100644
--- a/drivers/media/pci/solo6x10/solo6x10-g723.c
+++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
@@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
int solo_g723_init(struct solo_dev *solo_dev)
{
- static struct snd_device_ops ops = { NULL };
+ static struct snd_device_ops ops = { };
struct snd_card *card;
struct snd_kcontrol_new kctl;
char name[32];
--
2.7.4
--
Kees Cook
Nexus Security
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] solo6x10: use designated initializers
2016-12-17 1:05 [PATCH] solo6x10: use designated initializers Kees Cook
@ 2016-12-19 19:56 ` Andrey Utkin
2017-01-06 21:21 ` Kees Cook
0 siblings, 1 reply; 4+ messages in thread
From: Andrey Utkin @ 2016-12-19 19:56 UTC (permalink / raw)
To: Kees Cook
Cc: linux-kernel, Bluecherry Maintainers, Ismael Luceno,
Mauro Carvalho Chehab, linux-media, andrey_utkin
On Fri, Dec 16, 2016 at 05:05:36PM -0800, Kees Cook wrote:
> Prepare to mark sensitive kernel structures for randomization by making
> sure they're using designated initializers. These were identified during
> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
> extracted from grsecurity.
Ok I've reviewed all the patchset, googled a bit and now I see what's
going on.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
> index 6a35107aca25..36e93540bb49 100644
> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
> @@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>
> int solo_g723_init(struct solo_dev *solo_dev)
> {
> - static struct snd_device_ops ops = { NULL };
> + static struct snd_device_ops ops = { };
I'm not that keen on syntax subtleties, but...
* Empty initializer is not quite "designated" as I can judge.
* From brief googling I see that empty initializer is not valid in
some C standards.
Since `ops` is static, what about this?
For the variant given below, you have my signoff.
> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
> @@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>
> int solo_g723_init(struct solo_dev *solo_dev)
> {
> - static struct snd_device_ops ops = { NULL };
> + static struct snd_device_ops ops;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] solo6x10: use designated initializers
2016-12-19 19:56 ` Andrey Utkin
@ 2017-01-06 21:21 ` Kees Cook
2017-01-08 17:38 ` Andrey Utkin
0 siblings, 1 reply; 4+ messages in thread
From: Kees Cook @ 2017-01-06 21:21 UTC (permalink / raw)
To: Andrey Utkin
Cc: LKML, Bluecherry Maintainers, Ismael Luceno,
Mauro Carvalho Chehab, linux-media, andrey_utkin
On Mon, Dec 19, 2016 at 11:56 AM, Andrey Utkin
<andrey.utkin@corp.bluecherry.net> wrote:
> On Fri, Dec 16, 2016 at 05:05:36PM -0800, Kees Cook wrote:
>> Prepare to mark sensitive kernel structures for randomization by making
>> sure they're using designated initializers. These were identified during
>> allyesconfig builds of x86, arm, and arm64, with most initializer fixes
>> extracted from grsecurity.
>
> Ok I've reviewed all the patchset, googled a bit and now I see what's
> going on.
>
>>
>> Signed-off-by: Kees Cook <keescook@chromium.org>
>> ---
>> drivers/media/pci/solo6x10/solo6x10-g723.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c
>> index 6a35107aca25..36e93540bb49 100644
>> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
>> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
>> @@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>>
>> int solo_g723_init(struct solo_dev *solo_dev)
>> {
>> - static struct snd_device_ops ops = { NULL };
>> + static struct snd_device_ops ops = { };
>
> I'm not that keen on syntax subtleties, but...
> * Empty initializer is not quite "designated" as I can judge.
> * From brief googling I see that empty initializer is not valid in
> some C standards.
>
> Since `ops` is static, what about this?
> For the variant given below, you have my signoff.
>
>> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
>> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
>> @@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
>>
>> int solo_g723_init(struct solo_dev *solo_dev)
>> {
>> - static struct snd_device_ops ops = { NULL };
>> + static struct snd_device_ops ops;
Ah! Yes, thanks. That works fine too. :) Can this be const as well?
-Kees
--
Kees Cook
Nexus Security
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] solo6x10: use designated initializers
2017-01-06 21:21 ` Kees Cook
@ 2017-01-08 17:38 ` Andrey Utkin
0 siblings, 0 replies; 4+ messages in thread
From: Andrey Utkin @ 2017-01-08 17:38 UTC (permalink / raw)
To: Kees Cook
Cc: Andrey Utkin, LKML, Bluecherry Maintainers, Ismael Luceno,
Mauro Carvalho Chehab, linux-media
On Fri, Jan 06, 2017 at 01:21:10PM -0800, Kees Cook wrote:
> > Since `ops` is static, what about this?
> > For the variant given below, you have my signoff.
> >
> >> --- a/drivers/media/pci/solo6x10/solo6x10-g723.c
> >> +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c
> >> @@ -350,7 +350,7 @@ static int solo_snd_pcm_init(struct solo_dev *solo_dev)
> >>
> >> int solo_g723_init(struct solo_dev *solo_dev)
> >> {
> >> - static struct snd_device_ops ops = { NULL };
> >> + static struct snd_device_ops ops;
>
> Ah! Yes, thanks. That works fine too. :) Can this be const as well?
No, it can't be const, it's used as parameter for snd_device_new() which
takes "struct snd_device_ops *".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-08 17:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-17 1:05 [PATCH] solo6x10: use designated initializers Kees Cook
2016-12-19 19:56 ` Andrey Utkin
2017-01-06 21:21 ` Kees Cook
2017-01-08 17:38 ` Andrey Utkin
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 NNTP newsgroup(s).