<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/misc/xilinx_sdfec.c, branch v6.1.174</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.174</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v6.1.174'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2022-09-09T08:22:36+00:00</updated>
<entry>
<title>misc/xilinx_sdfec: Replace kmap() with kmap_local_page()</title>
<updated>2022-09-09T08:22:36+00:00</updated>
<author>
<name>Fabio M. De Francesco</name>
<email>fmdefrancesco@gmail.com</email>
</author>
<published>2022-09-01T15:44:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=eb3b3c93afc4a4244590f7d1e715e8b6749585a9'/>
<id>urn:sha1:eb3b3c93afc4a4244590f7d1e715e8b6749585a9</id>
<content type='text'>
kmap() is being deprecated in favor of kmap_local_page().

There are two main problems with kmap(): (1) It comes with an overhead as
the mapping space is restricted and protected by a global lock for
synchronization and (2) it also requires global TLB invalidation when the
kmap’s pool wraps and it might block when the mapping space is fully
utilized until a slot becomes available.

With kmap_local_page() the mappings are per thread, CPU local, can take
page faults, and can be called from any context (including interrupts).
It is faster than kmap() in kernels with HIGHMEM enabled. Furthermore,
the tasks can be preempted and, when they are scheduled to run again, the
kernel virtual addresses are restored and still valid.

Since its use in xilinx_sdfec.c is safe, replace kmap()i / kunmap() with
kmap_local_page() / kunmap_local().

Cc: "Venkataramanan, Anirudh" &lt;anirudh.venkataramanan@intel.com&gt;
Suggested-by: Ira Weiny &lt;ira.weiny@intel.com&gt;
Signed-off-by: Fabio M. De Francesco &lt;fmdefrancesco@gmail.com&gt;
Link: https://lore.kernel.org/r/20220901154408.23984-3-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc/xilinx_sdfec: Call kunmap() on pages mapped with kmap()</title>
<updated>2022-09-09T08:22:36+00:00</updated>
<author>
<name>Fabio M. De Francesco</name>
<email>fmdefrancesco@gmail.com</email>
</author>
<published>2022-09-01T15:44:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=e01b08d7f6d36f20533b7510ea3af90756125f35'/>
<id>urn:sha1:e01b08d7f6d36f20533b7510ea3af90756125f35</id>
<content type='text'>
Pages in an array are mapped in a loop but, after the code is done with
the virtual addresses, these pages are never unmapped.

Therefore, call kunmap() to unmap pages[i].

Cc: "Venkataramanan, Anirudh" &lt;anirudh.venkataramanan@intel.com&gt;
Cc: Ira Weiny &lt;ira.weiny@intel.com&gt;
Signed-off-by: Fabio M. De Francesco &lt;fmdefrancesco@gmail.com&gt;
Link: https://lore.kernel.org/r/20220901154408.23984-2-fmdefrancesco@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: Drop unnecessary NULL check after container_of</title>
<updated>2021-05-21T20:14:48+00:00</updated>
<author>
<name>Guenter Roeck</name>
<email>linux@roeck-us.net</email>
</author>
<published>2021-05-21T20:04:57+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=78429edfeed8da0562243e876be46d700f9ed13c'/>
<id>urn:sha1:78429edfeed8da0562243e876be46d700f9ed13c</id>
<content type='text'>
container_of() only returns NULL if the passed pointer is NULL _and_ if
the embedded element is the first element of the structure. Even if that
is the case, testing against it is misleading and possibly dangerous
because the position of the embedded element may change. In this case,
the check is unnecessary since it is known that file-&gt;private_data is
never NULL for an open file, and container_of() will therefore also
never be NULL. Drop the check.

Acked-by: Dragan Cvetic &lt;dragan.cvetic@xilinx.com&gt;
Signed-off-by: Guenter Roeck &lt;linux@roeck-us.net&gt;
Link: https://lore.kernel.org/r/20210521200457.2112041-1-linux@roeck-us.net
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: remove check for ioctl cmd and argument.</title>
<updated>2020-11-03T09:11:48+00:00</updated>
<author>
<name>Harshal Chaudhari</name>
<email>harshalchau04@gmail.com</email>
</author>
<published>2020-11-01T17:09:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=c78c95f919539cad0308e7de0d5d0d656e4a8e98'/>
<id>urn:sha1:c78c95f919539cad0308e7de0d5d0d656e4a8e98</id>
<content type='text'>
if (_IOC_TYPE(cmd) != PP_IOCTL)
        return -ENOTTY;

Invalid ioctl command check normally performs by “default” case.

if (_IOC_DIR(cmd) != _IOC_NONE) {
       argp = (void __user *)arg;
       if (!argp)
             return -EINVAL; }

And for checking ioctl arguments, copy_from_user()/copy_to_user()
checks are enough.

Reviewed-by: Arnd Bergmann &lt;arnd@arndb.de&gt;
Signed-off-by: Harshal Chaudhari &lt;harshalchau04@gmail.com&gt;
Link: https://lore.kernel.org/r/20201101170949.18616-1-harshalchau04@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx_sdfec: add compat_ptr_ioctl()</title>
<updated>2020-10-29T07:37:36+00:00</updated>
<author>
<name>Harshal Chaudhari</name>
<email>harshalchau04@gmail.com</email>
</author>
<published>2020-10-26T15:58:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3f7566f4947834db9b36aeb8b308e91448ba74fc'/>
<id>urn:sha1:3f7566f4947834db9b36aeb8b308e91448ba74fc</id>
<content type='text'>
Driver has a trivial helper function to convert
the pointer argument and then call the native ioctl handler.
But now we have a generic implementation for that, so we can use it.

Signed-off-by: Harshal Chaudhari &lt;harshalchau04@gmail.com&gt;
Link: https://lore.kernel.org/r/20201026155801.16053-1-harshalchau04@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: convert get_user_pages() --&gt; pin_user_pages()</title>
<updated>2020-05-27T09:09:26+00:00</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2020-05-27T01:26:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=03358b0f7bc7b5868bbb30f47224a937e2e4d6d3'/>
<id>urn:sha1:03358b0f7bc7b5868bbb30f47224a937e2e4d6d3</id>
<content type='text'>
This code was using get_user_pages*(), in approximately a "Case 1"
scenario (Direct IO), using the categorization from [1]. That means
that it's time to convert the get_user_pages*() + put_page() calls to
pin_user_pages*() + unpin_user_pages() calls.

There is some helpful background in [2]: basically, this is a small
part of fixing a long-standing disconnect between pinning pages, and
file systems' use of those pages.

[1] Documentation/core-api/pin_user_pages.rst

[2] "Explicit pinning of user-space pages":
    https://lwn.net/Articles/807108/

Cc: Derek Kiernan &lt;derek.kiernan@xilinx.com&gt;
Cc: Dragan Cvetic &lt;dragan.cvetic@xilinx.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Michal Simek &lt;michal.simek@xilinx.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Link: https://lore.kernel.org/r/20200527012628.1100649-4-jhubbard@nvidia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: cleanup return value in xsdfec_table_write()</title>
<updated>2020-05-27T09:09:26+00:00</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2020-05-27T01:26:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=d25594d764613ad58656bbe74a86706204813a9f'/>
<id>urn:sha1:d25594d764613ad58656bbe74a86706204813a9f</id>
<content type='text'>
Return 0 for success, rather than the value of an incrementing
"reg" index. The reg value was never actually used, so this
simplifies the caller slightly.

Cc: Derek Kiernan &lt;derek.kiernan@xilinx.com&gt;
Cc: Dragan Cvetic &lt;dragan.cvetic@xilinx.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Michal Simek &lt;michal.simek@xilinx.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Link: https://lore.kernel.org/r/20200527012628.1100649-3-jhubbard@nvidia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: improve get_user_pages_fast() error handling</title>
<updated>2020-05-27T09:09:26+00:00</updated>
<author>
<name>John Hubbard</name>
<email>jhubbard@nvidia.com</email>
</author>
<published>2020-05-27T01:26:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=57343d51613227373759f5b0f2eede257fd4b82e'/>
<id>urn:sha1:57343d51613227373759f5b0f2eede257fd4b82e</id>
<content type='text'>
This fixes the case of get_user_pages_fast() returning a -errno.
The result needs to be stored in a signed integer. And for safe
signed/unsigned comparisons, it's best to keep everything signed.
And get_user_pages_fast() also expects a signed value for number
of pages to pin.

Therefore, change most relevant variables, from u32 to int. Leave
"n" unsigned, for convenience in checking for overflow. And provide
a WARN_ON_ONCE() and early return, if overflow occurs.

Also, as long as we're tidying up: rename the page array from page,
to pages, in order to match the conventions used in most other call
sites.

Fixes: 20ec628e8007e ("misc: xilinx_sdfec: Add ability to configure LDPC")
Cc: Derek Kiernan &lt;derek.kiernan@xilinx.com&gt;
Cc: Dragan Cvetic &lt;dragan.cvetic@xilinx.com&gt;
Cc: Arnd Bergmann &lt;arnd@arndb.de&gt;
Cc: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
Cc: Michal Simek &lt;michal.simek@xilinx.com&gt;
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: John Hubbard &lt;jhubbard@nvidia.com&gt;
Link: https://lore.kernel.org/r/20200527012628.1100649-2-jhubbard@nvidia.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx-sdfec: convert to module_platform_driver()</title>
<updated>2020-05-15T14:20:01+00:00</updated>
<author>
<name>Harshal Chaudhari</name>
<email>harshalchau04@gmail.com</email>
</author>
<published>2020-05-10T16:43:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=286adb4cce00d2ed37eb20a19ce366d1d58adf42'/>
<id>urn:sha1:286adb4cce00d2ed37eb20a19ce366d1d58adf42</id>
<content type='text'>
The driver init and exit function don't do anything besides registering
and unregistering the platform driver, so the module_platform_driver()
macro could just be used instead of having separate functions.

Signed-off-by: Harshal Chaudhari &lt;harshalchau04@gmail.com&gt;
Acked-by: Dragan Cvetic &lt;dragan.cvetic@xilinx.com&gt;
Link: https://lore.kernel.org/r/20200510164308.31358-1-harshalchau04@gmail.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>misc: xilinx_sdfec: Use memdup_user() as a cleanup</title>
<updated>2020-04-23T14:32:51+00:00</updated>
<author>
<name>Zou Wei</name>
<email>zou_wei@huawei.com</email>
</author>
<published>2020-04-22T02:58:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=15665c062b8c529d162479b306af23bc37bb6a12'/>
<id>urn:sha1:15665c062b8c529d162479b306af23bc37bb6a12</id>
<content type='text'>
Fix coccicheck warning which recommends to use memdup_user().

This patch fixes the following coccicheck warnings:

drivers/misc/xilinx_sdfec.c:652:8-15: WARNING opportunity for memdup_user

Reported-by: Hulk Robot &lt;hulkci@huawei.com&gt;
Signed-off-by: Zou Wei &lt;zou_wei@huawei.com&gt;
Link: https://lore.kernel.org/r/1587524330-119776-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
</feed>
