All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Morse <james.morse@arm.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Tyler Baicar <tbaicar@codeaurora.org>,
	christoffer.dall@linaro.org, marc.zyngier@arm.com,
	pbonzini@redhat.com, rkrcmar@redhat.com, catalin.marinas@arm.com,
	will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org,
	matt@codeblueprint.co.uk, robert.moore@intel.com,
	lv.zheng@intel.com, nkaje@codeaurora.org, zjzhang@codeaurora.org,
	mark.rutland@arm.com, akpm@linux-foundation.org,
	eun.taik.lee@samsung.com, sandeepa.s.prabhu@gmail.com,
	labbott@redhat.com, shijie.huang@arm.com,
	rruigrok@codeaurora.org, paul.gortmaker@windriver.com,
	tn@semihalf.com, fu.wei@linaro.org, rostedt@goodmis.org,
	bristot@redhat.com, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-efi@vger.kernel.org, devel@acpic
Subject: Re: [PATCH V10 07/10] efi: print unrecognized CPER section
Date: Wed, 22 Feb 2017 10:13:28 +0000	[thread overview]
Message-ID: <58AD6448.1070301@arm.com> (raw)
In-Reply-To: <20170222011241.GX21222@n2100.armlinux.org.uk>

On 22/02/17 01:12, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 07:10:11PM +0000, James Morse wrote:
>> Hi Tyler,
>>
>> On 15/02/17 19:51, Tyler Baicar wrote:
>>> +	} else {
>>> +		const void *unknown_err;
>>> +
>>> +		unknown_err = acpi_hest_generic_data_payload(gdata);
>>> +		printk("%ssection type: %pUl\n", newpfx, sec_type);
>>> +		printk("%ssection length: %d\n", newpfx,
>>
>> Nit: please use the "%s""section... that this file consistently uses. This means
>> this code will still work as expected when someone adds '%ss' support to printk!
> 
> No.  That is wrong:
> 
> "%s""section" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> whereas "%ssection" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> They're exactly the same, so when printk() comes to parse the string, it
> sees exactly the same byte sequence.  So, the only thing that's happening
> is code obfuscation for no good reason what so ever.
> 
> If you don't believe me, run some build tests and look at the resulting
> strings... also look at the C standard.  "Adjacent string literal tokens
> are concatenated."
> 
> Please get rid of this obfuscation.

Sure, I was always told not do this, clearly I didn't think about it for very long!

This file otherwise consistently uses the now-weird "%s""otherstring" pattern.



Thanks,

James



WARNING: multiple messages have this Message-ID (diff)
From: james.morse@arm.com (James Morse)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH V10 07/10] efi: print unrecognized CPER section
Date: Wed, 22 Feb 2017 10:13:28 +0000	[thread overview]
Message-ID: <58AD6448.1070301@arm.com> (raw)
In-Reply-To: <20170222011241.GX21222@n2100.armlinux.org.uk>

On 22/02/17 01:12, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 07:10:11PM +0000, James Morse wrote:
>> Hi Tyler,
>>
>> On 15/02/17 19:51, Tyler Baicar wrote:
>>> +	} else {
>>> +		const void *unknown_err;
>>> +
>>> +		unknown_err = acpi_hest_generic_data_payload(gdata);
>>> +		printk("%ssection type: %pUl\n", newpfx, sec_type);
>>> +		printk("%ssection length: %d\n", newpfx,
>>
>> Nit: please use the "%s""section... that this file consistently uses. This means
>> this code will still work as expected when someone adds '%ss' support to printk!
> 
> No.  That is wrong:
> 
> "%s""section" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> whereas "%ssection" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> They're exactly the same, so when printk() comes to parse the string, it
> sees exactly the same byte sequence.  So, the only thing that's happening
> is code obfuscation for no good reason what so ever.
> 
> If you don't believe me, run some build tests and look at the resulting
> strings... also look at the C standard.  "Adjacent string literal tokens
> are concatenated."
> 
> Please get rid of this obfuscation.

Sure, I was always told not do this, clearly I didn't think about it for very long!

This file otherwise consistently uses the now-weird "%s""otherstring" pattern.



Thanks,

James

WARNING: multiple messages have this Message-ID (diff)
From: James Morse <james.morse@arm.com>
To: Russell King - ARM Linux <linux@armlinux.org.uk>
Cc: Tyler Baicar <tbaicar@codeaurora.org>,
	christoffer.dall@linaro.org, marc.zyngier@arm.com,
	pbonzini@redhat.com, rkrcmar@redhat.com, catalin.marinas@arm.com,
	will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org,
	matt@codeblueprint.co.uk, robert.moore@intel.com,
	lv.zheng@intel.com, nkaje@codeaurora.org, zjzhang@codeaurora.org,
	mark.rutland@arm.com, akpm@linux-foundation.org,
	eun.taik.lee@samsung.com, sandeepa.s.prabhu@gmail.com,
	labbott@redhat.com, shijie.huang@arm.com,
	rruigrok@codeaurora.org, paul.gortmaker@windriver.com,
	tn@semihalf.com, fu.wei@linaro.org, rostedt@goodmis.org,
	bristot@redhat.com, linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu, kvm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-efi@vger.kernel.org, devel@acpica.org,
	Suzuki.Poulose@arm.com, punit.agrawal@arm.com, astone@redhat.com,
	harba@codeaurora.org, hanjun.guo@linaro.org,
	john.garry@huawei.com, shiju.jose@huawei.com
Subject: Re: [PATCH V10 07/10] efi: print unrecognized CPER section
Date: Wed, 22 Feb 2017 10:13:28 +0000	[thread overview]
Message-ID: <58AD6448.1070301@arm.com> (raw)
In-Reply-To: <20170222011241.GX21222@n2100.armlinux.org.uk>

On 22/02/17 01:12, Russell King - ARM Linux wrote:
> On Tue, Feb 21, 2017 at 07:10:11PM +0000, James Morse wrote:
>> Hi Tyler,
>>
>> On 15/02/17 19:51, Tyler Baicar wrote:
>>> +	} else {
>>> +		const void *unknown_err;
>>> +
>>> +		unknown_err = acpi_hest_generic_data_payload(gdata);
>>> +		printk("%ssection type: %pUl\n", newpfx, sec_type);
>>> +		printk("%ssection length: %d\n", newpfx,
>>
>> Nit: please use the "%s""section... that this file consistently uses. This means
>> this code will still work as expected when someone adds '%ss' support to printk!
> 
> No.  That is wrong:
> 
> "%s""section" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> whereas "%ssection" is stored in memory as bytes containing:
> 
> '%' 's' 's' 'e' 'c' 't' 'i' 'o' 'n'
> 
> They're exactly the same, so when printk() comes to parse the string, it
> sees exactly the same byte sequence.  So, the only thing that's happening
> is code obfuscation for no good reason what so ever.
> 
> If you don't believe me, run some build tests and look at the resulting
> strings... also look at the C standard.  "Adjacent string literal tokens
> are concatenated."
> 
> Please get rid of this obfuscation.

Sure, I was always told not do this, clearly I didn't think about it for very long!

This file otherwise consistently uses the now-weird "%s""otherstring" pattern.



Thanks,

James

  reply	other threads:[~2017-02-22 10:13 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-15 19:51 [PATCH V10 00/10] Add UEFI 2.6 and ACPI 6.1 updates for RAS on ARM64 Tyler Baicar
2017-02-15 19:51 ` Tyler Baicar
2017-02-15 19:51 ` Tyler Baicar
2017-02-15 19:51 ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 01/10] acpi: apei: read ack upon ghes record consumption Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 02/10] ras: acpi/apei: cper: generic error data entry v3 per ACPI 6.1 Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-16 18:25   ` Ard Biesheuvel
2017-02-16 18:25     ` Ard Biesheuvel
2017-02-16 18:25     ` Ard Biesheuvel
2017-02-16 18:25     ` Ard Biesheuvel
2017-02-15 19:51 ` [PATCH V10 03/10] efi: parse ARM processor error Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
     [not found]   ` <1487188282-2568-4-git-send-email-tbaicar-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-02-16 18:26     ` Ard Biesheuvel
2017-02-16 18:26       ` Ard Biesheuvel
2017-02-16 18:26       ` Ard Biesheuvel
2017-02-16 18:26       ` Ard Biesheuvel
2017-02-15 19:51 ` [PATCH V10 04/10] arm64: exception: handle Synchronous External Abort Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 05/10] acpi: apei: handle SEA notification type for ARMv8 Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-16 18:32   ` Ard Biesheuvel
2017-02-16 18:32     ` Ard Biesheuvel
2017-02-16 18:32     ` Ard Biesheuvel
2017-02-16 18:32     ` Ard Biesheuvel
2017-02-21 16:52     ` Baicar, Tyler
2017-02-21 16:52       ` Baicar, Tyler
2017-02-21 16:52       ` Baicar, Tyler
2017-02-21 16:52       ` Baicar, Tyler
2017-02-15 19:51 ` [PATCH V10 06/10] acpi: apei: panic OS with fatal error status block Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 07/10] efi: print unrecognized CPER section Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 20:07   ` Joe Perches
2017-02-15 20:07     ` Joe Perches
2017-02-15 20:07     ` Joe Perches
2017-02-15 20:31     ` Baicar, Tyler
2017-02-15 20:31       ` Baicar, Tyler
2017-02-15 20:31       ` Baicar, Tyler
2017-02-15 20:31       ` Baicar, Tyler
2017-02-21 19:10   ` James Morse
2017-02-21 19:10     ` James Morse
2017-02-21 19:10     ` James Morse
2017-02-21 19:39     ` Baicar, Tyler
2017-02-21 19:39       ` Baicar, Tyler
2017-02-21 19:39       ` Baicar, Tyler
     [not found]       ` <9b8aee3f-9ab6-121a-cad0-96a39743de55-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2017-02-22  0:30         ` Joe Perches
2017-02-22  0:30           ` Joe Perches
2017-02-22  0:30           ` Joe Perches
2017-02-22  1:12     ` Russell King - ARM Linux
2017-02-22  1:12       ` Russell King - ARM Linux
2017-02-22  1:12       ` Russell King - ARM Linux
2017-02-22 10:13       ` James Morse [this message]
2017-02-22 10:13         ` James Morse
2017-02-22 10:13         ` James Morse
2017-02-15 19:51 ` [PATCH V10 08/10] ras: acpi / apei: generate trace event for " Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 09/10] trace, ras: add ARM processor error trace event Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51 ` [PATCH V10 10/10] arm/arm64: KVM: add guest SEA support Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar
2017-02-15 19:51   ` Tyler Baicar

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=58AD6448.1070301@arm.com \
    --to=james.morse@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=bristot@redhat.com \
    --cc=catalin.marinas@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=devel@acpic \
    --cc=eun.taik.lee@samsung.com \
    --cc=fu.wei@linaro.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=labbott@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lv.zheng@intel.com \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=matt@codeblueprint.co.uk \
    --cc=nkaje@codeaurora.org \
    --cc=paul.gortmaker@windriver.com \
    --cc=pbonzini@redhat.com \
    --cc=rjw@rjwysocki.net \
    --cc=rkrcmar@redhat.com \
    --cc=robert.moore@intel.com \
    --cc=rostedt@goodmis.org \
    --cc=rruigrok@codeaurora.org \
    --cc=sandeepa.s.prabhu@gmail.com \
    --cc=shijie.huang@arm.com \
    --cc=tbaicar@codeaurora.org \
    --cc=tn@semihalf.com \
    --cc=will.deacon@arm.com \
    --cc=zjzhang@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.