lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 5 Jan 2018 17:45:04 +0000
From:   Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:     Catalin Marinas <catalin.marinas@....com>
Cc:     Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        linux-mips <linux-mips@...ux-mips.org>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Will Deacon <will.deacon@....com>,
        Paul Mackerras <paulus@...ba.org>,
        "H. Peter Anvin" <hpa@...or.com>, sparclinux@...r.kernel.org,
        linux-s390 <linux-s390@...r.kernel.org>,
        Nicolas Pitre <nico@...aro.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        Russell King <linux@...linux.org.uk>,
        Ingo Molnar <mingo@...hat.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Petr Mladek <pmladek@...e.com>,
        Kees Cook <keescook@...omium.org>,
        Arnd Bergmann <arnd@...db.de>,
        Heiko Carstens <heiko.carstens@...ibm.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        James Morris <james.l.morris@...cle.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-arm-kernel@...ts.infradead.org,
        linuxppc-dev <linuxppc-dev@...ts.ozlabs.org>,
        Ralf Baechle <ralf@...ux-mips.org>,
        Thomas Garnier <thgarnie@...gle.com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Jessica Yu <jeyu@...nel.org>,
        Martin Schwidefsky <schwidefsky@...ibm.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        "David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH v7 05/10] PCI: Add support for relative addressing in
 quirk tables

On 5 January 2018 at 17:41, Catalin Marinas <catalin.marinas@....com> wrote:
> On Tue, Jan 02, 2018 at 08:05:44PM +0000, Ard Biesheuvel wrote:
>> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
>> index 10684b17d0bd..b6d51b4d5ce1 100644
>> --- a/drivers/pci/quirks.c
>> +++ b/drivers/pci/quirks.c
>> @@ -3556,9 +3556,16 @@ static void pci_do_fixups(struct pci_dev *dev, struct pci_fixup *f,
>>                    f->vendor == (u16) PCI_ANY_ID) &&
>>                   (f->device == dev->device ||
>>                    f->device == (u16) PCI_ANY_ID)) {
>> -                     calltime = fixup_debug_start(dev, f->hook);
>> -                     f->hook(dev);
>> -                     fixup_debug_report(dev, calltime, f->hook);
>> +                     void (*hook)(struct pci_dev *dev);
>> +#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
>> +                     hook = (void *)((unsigned long)&f->hook_offset +
>> +                                     f->hook_offset);
>> +#else
>> +                     hook = f->hook;
>> +#endif
>
> More of a nitpick but I've seen this pattern in several places in your
> code, maybe worth defining a macro (couldn't come up with a better
> name):
>
> #define offset_to_ptr(off) \
>         ((void *)((unsigned long)&(off) + (off)))
>

Yeah, good point. Or even

static inline void *offset_to_ptr(const s32 *off)
{
    return (void *)((unsigned long)off + *off);
}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ