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: <6a47c4f6-096e-626d-6761-5f88a07609a7@codeaurora.org>
Date:   Fri, 8 Dec 2017 09:33:27 -0500
From:   Sinan Kaya <okaya@...eaurora.org>
To:     Lothar Waßmann <LW@...O-electronics.de>
Cc:     devicetree@...r.kernel.org, linux-arm-msm@...r.kernel.org,
        timur@...eaurora.org, open list <linux-kernel@...r.kernel.org>,
        linux-acpi@...r.kernel.org, Rob Herring <robh+dt@...nel.org>,
        dmaengine@...r.kernel.org, Frank Rowand <frowand.list@...il.com>,
        linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH V6 4/7] OF: properties: Implement get_match_data()
 callback

On 12/8/2017 4:11 AM, Lothar Waßmann wrote:
>> While implementing the ACPI piece, I have to convert an unsigned long to
>> (const void *) in ACPI code so that the APIs are compatible.
>>
> Just one more remark: Do you need write access to the data the pointer
> returned by device_get_match_data() or of_fwnode_get_match_data()
> points to?
> If not, the return type of those functions should be 'const void *'.

Yes, the only reason driver is trying to obtain this data pointer is to modify
members of it. I did a quick test with your suggestion.

test.c: In function ‘main’:
test.c:15:2: error: assignment of member ‘m’ in read-only object
  t->m = 3;
  ^

struct test
{
        int m;
};

int main(void)
{
        const void *ptr;
        unsigned long l =4;
        const struct test *t;

        ptr = (const void *)l;

        t = ptr;
        t->m = 3;
}



-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ