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]
Message-ID: <46d4b5d2-55ca-0af3-bb02-7d49d9d2d4fa@foss.st.com>
Date:   Wed, 26 Jul 2023 12:32:31 +0200
From:   Gatien CHEVALLIER <gatien.chevallier@...s.st.com>
To:     Simon Horman <simon.horman@...igine.com>
CC:     <Oleksii_Moisieiev@...m.com>, <gregkh@...uxfoundation.org>,
        <herbert@...dor.apana.org.au>, <davem@...emloft.net>,
        <robh+dt@...nel.org>, <krzysztof.kozlowski+dt@...aro.org>,
        <conor+dt@...nel.org>, <alexandre.torgue@...s.st.com>,
        <vkoul@...nel.org>, <jic23@...nel.org>,
        <olivier.moysan@...s.st.com>, <arnaud.pouliquen@...s.st.com>,
        <mchehab@...nel.org>, <fabrice.gasnier@...s.st.com>,
        <andi.shyti@...nel.org>, <ulf.hansson@...aro.org>,
        <edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>,
        <hugues.fruchet@...s.st.com>, <lee@...nel.org>, <will@...nel.org>,
        <catalin.marinas@....com>, <arnd@...nel.org>,
        <richardcochran@...il.com>, Frank Rowand <frowand.list@...il.com>,
        <linux-crypto@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-stm32@...md-mailman.stormreply.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, <dmaengine@...r.kernel.org>,
        <linux-i2c@...r.kernel.org>, <linux-iio@...r.kernel.org>,
        <alsa-devel@...a-project.org>, <linux-media@...r.kernel.org>,
        <linux-mmc@...r.kernel.org>, <netdev@...r.kernel.org>,
        <linux-phy@...ts.infradead.org>, <linux-serial@...r.kernel.org>,
        <linux-spi@...r.kernel.org>, <linux-usb@...r.kernel.org>
Subject: Re: [PATCH v2 07/11] bus: rifsc: introduce RIFSC firewall controller
 driver



On 7/26/23 12:26, Simon Horman wrote:
> On Tue, Jul 25, 2023 at 06:41:00PM +0200, Gatien Chevallier wrote:
> 
> ...
> 
>> diff --git a/drivers/bus/stm32_rifsc.c b/drivers/bus/stm32_rifsc.c
> 
> ...
> 
>> +static int stm32_rif_acquire_semaphore(struct stm32_firewall_controller *stm32_firewall_controller,
>> +				       int id)
>> +{
>> +	void __iomem *addr = stm32_firewall_controller->mmio + RIFSC_RISC_PER0_SEMCR + 0x8 * id;
>> +
>> +	__set_bit(SEMCR_MUTEX, addr);
> 
> Hi Gatien,
> 
> Sparse seem a bit unhappy about this.
> 
>   .../stm32_rifsc.c:83:9: warning: cast removes address space '__iomem' of expression
>   .../stm32_rifsc.c:83:9: warning: incorrect type in argument 2 (different address spaces)
>   .../stm32_rifsc.c:83:9:    expected unsigned long volatile *addr
>   .../stm32_rifsc.c:83:9:    got void [noderef] __iomem *addr
>   .../stm32_rifsc.c:83:9: warning: incorrect type in argument 2 (different address spaces)
>   .../stm32_rifsc.c:83:9:    expected unsigned long volatile *addr
>   .../stm32_rifsc.c:83:9:    got void [noderef] __iomem *addr
> 
> But it's not immediately apparent to me what a good solution is.
> 

Hi Simon,

This is indeed incorrect, set_bit is used to modify bit fields, not
writing to a register. I'll change to writel, as in
stm32_rif_release_semaphore(). Thank you for pointing this out.

Best regards,
Gatien
>> +
>> +	/* Check that CID1 has the semaphore */
>> +	if (stm32_rifsc_is_semaphore_available(addr) ||
>> +	    FIELD_GET(RIFSC_RISC_SCID_MASK, readl(addr)) != RIF_CID1)
>> +		return -EACCES;
>> +
>> +	return 0;
>> +}
> 
> ...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ