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  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:   Thu, 30 Aug 2018 07:37:38 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Palmer Dabbelt <palmer@...ive.com>
Cc:     linux-riscv@...ts.infradead.org, daniel.lezcano@...aro.org,
        jason@...edaemon.net, ard.biesheuvel@...aro.org,
        marc.zyngier@....com, catalin.marinas@....com,
        dmitriy@...-tech.org, jeremy.linton@....com,
        linux-kernel@...r.kernel.org, atish.patra@....com,
        aou@...s.berkeley.edu, Greg KH <gregkh@...uxfoundation.org>,
        tglx@...utronix.de
Subject: Re: [PATCH 1/8] RISC-V: Provide a cleaner raw_smp_processor_id()

On Mon, Aug 27, 2018 at 11:42:36AM -0700, Palmer Dabbelt wrote:
> +/* Obtains the hart ID of the currently executing task.  This relies on
> + * THREAD_INFO_IN_TASK, but we define that unconditionally. */

Kernel comment style would be:

/*
 * Obtains the hart ID of the currently executing task.  This relies on
 * THREAD_INFO_IN_TASK, but we define that unconditionally.
 */

> +#ifdef CONFIG_THREAD_INFO_IN_TASK

THREAD_INFO_IN_TASK is always defined for riscv, so no need for this
ifdef.

> +#define get_ti()                ((struct thread_info *)get_current())
> +#define raw_smp_processor_id()  (get_ti()->cpu)

Please don't cast structs around.  This should be something like

#define raw_smp_processor_id() \
	(container_of(get_current(), struct task_struct, thread_info)->cpu)

Powered by blists - more mailing lists