faulted variable used in
tracing_mark_raw_write().
Finally, for the two runs of spaces, just use variables initialized with
string literals; the linker (at least for x86) will reuse the tail of
the longer for the shorter string.
Signed-off-by: Rasmus Villemoes
---
kernel/trace/ftrace.c | 2
ction old new delta
trace_default_header 663 642 -21
tracing_mark_raw_write 406 355 -51
tracing_mark_write 624 557 -67
Total: Before=63721, After=63582, chg -0.22%
Signed-off-by: Rasmus Vill
20 20 movabs $0x20202e646e756f66,%rax
Make them all static so that the compiler just references objects in .rodata.
Signed-off-by: Rasmus Villemoes
---
tools/perf/builtin-c2c.c| 4 ++--
tools/perf/builtin-kmem.c | 4 ++--
tools/perf/builtin-report.c | 6 +++---
tools/perf/bu
On 2018-11-01 23:57, Kees Cook wrote:
>> Yes, gcc should be able to infer the constness of drv from the fact that
>> it's never assigned to elsewhere in the function... I think I saw that
>> on some gcc todo list at some point.
>
> If you find that bug, I'll add it to my gcc bug tracking list. :P
kstrdup_quotable_cmdline takes gfp flags and passes those on to
kstrdup_quotable, but before that it has done a kmalloc(PAGE_SIZE) with
a hard-coded GFP_KERNEL. There is one caller of kstrdup_quotable_cmdline
which passes GFP_ATOMIC, and the commit introducing that (65a3c2748e)
conveniently has thi
On 2018-11-05 22:48, Bart Van Assche wrote:
> On Mon, 2018-11-05 at 13:13 -0800, Andrew Morton wrote:
>> On Mon, 5 Nov 2018 12:40:00 -0800 Bart Van Assche
>> wrote:
>>
>>> This patch suppresses the following sparse warning:
>>>
>>> ./include/linux/slab.h:332:43: warning: dubious: x & !y
>>>
>>>
On 2018-10-11 01:03, Bryan O'Donoghue wrote:
> On 05/10/2018 15:28, Rasmus Villemoes wrote:
>> Signed-off-by: Rasmus Villemoes
>> ---
>> I have no idea if the performance matters (it probably doesn't). Feel
>> free to ignore this and the followup cleanup.
>
orted.
Reviewed-by: Bryan O'Donoghue
Signed-off-by: Rasmus Villemoes
---
Sending as a proper patch. Marked v2 since this replaces earlier 2/3
and 3/3 patches. Applies on top of
b4fc4e8340784e30c5a59bf0791f9c3ce15e (staging: greybus:
loopback.c: remove unused gb_loopback::lbid).
drive
about the state of close_on_exec in the new
bits when we expand the fdtable, we don't need to clear close_on_exec[i]
in do_close_on_exec, and since we may have quite a few bits set in
close_on_exec[i] without an actual open file, mask the set with
open_fds[i].
Signed-off-by: Rasmus Villemoe
On 2018-10-25 16:17, Sasha Levin wrote:
> From: Rasmus Villemoes
>
> [ Upstream commit e87c3f80ad0490d26ffe04754b7d094463b40f30 ]
>
> !strncmp(buf, "force host", 9) is true if and only if buf starts with
> "force hos". This was obviously not what was intend
the declaration of the str buffer inside the CONFIG_KALLSYMS guard,
which in turn will make gcc inline the function for !CONFIG_KALLSYMS (it
only has a single caller, but the huge stack frame seems to make gcc not
inline it for CONFIG_KALLSYMS).
Signed-off-by: Rasmus Villemoes
---
kernel/trace/tra
These two functions are nearly identical, so we can avoid some code
duplication by moving the conditional into a common implementation.
Signed-off-by: Rasmus Villemoes
---
kernel/trace/trace_output.c | 34 +++---
1 file changed, 7 insertions(+), 27 deletions(-)
diff
single caller which passes "%s" as fmt, so
we might as well just use that directly. That also paves the way for
further cleanups that will actually make that format string go away
entirely.
Signed-off-by: Rasmus Villemoes
---
kernel/trace/trace_output.c | 9 -
1 file changed, 4
complain in the unlikely case one of the
LINUX_* strings ended up containing a %. This also avoids compiling it
in for !CONFIG_PROC_FS.
Signed-off-by: Rasmus Villemoes
---
fs/proc/version.c | 6 ++
include/linux/printk.h | 1 -
init/version.c | 5 -
3 files changed, 6 insertions
with a string not
containing format specifiers, but we might as well silence this warning
using "%s" as format string.
Signed-off-by: Rasmus Villemoes
---
arch/x86/kernel/traps.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kern
Some users may prefer to check a "user-supplied" string upfront and
return EINVAL rather than using the the template as a fallback for
printf'ing later. fmtmatch() is simply a shorthand for
fmtcheck(a, b, c | FMTCHECK_SILENT) == a.
Signed-off-by: Rasmus Villemoes
---
include
One is supposed to pass in a format string containing (at most) one %u
instance. Use fmtcheck() to enforce that at runtime, WARNing and falling
back to a harmless "kthread/%u" in case verification fails.
Signed-off-by: Rasmus Villemoes
---
kernel/kthread.c | 4 ++--
1 file changed, 2
ever appear in a hot path.
The BSDs (and libbsd on linux) contain a fmtcheck() function; I took the
name and return semantics from that.
Signed-off-by: Rasmus Villemoes
---
include/linux/kernel.h | 18
lib/Kconfig.debug | 9 ++
lib/vsprintf.c | 65 ++
mpiler cannot do any type checking.
Even a static inline fmtcheck() that just returns its first argument
would provide documentation for which specifiers what->ever is supposed
to contain, but we'll implement an actual run-time check later.
Signed-off-by: Rasmus Villemoes
---
include/lin
check of fmt to ensure it doesn't contain odd printf
specifiers that would make snprintf go off into the weeds. The lack of
the FMTCHECK_NO_EXTRA_ARGS flag (i.e., the last 0 argument) means we
allow either no specifiers or precisely one occurrence of %s in tmp.
Signed-off-by: Rasmus Vi
It should be trivial to add more test cases, once we figure out the
exact rules for being compatible or not. Perhaps we'll have to extend
the struct test with a flags element if we add flags that affect the
return value.
Signed-off-by: Rasmus Villemoes
---
lib/test_printf.c
On 7 September 2018 at 09:46, Rasmus Villemoes wrote:
> This allows kmemdup_nul to be used in cases where the source pointer is
> not a char* or const char*, but the result should nevertheless have a
> nul char after the memcpy'ed data.
ping
On 2018-07-07 15:54, Tetsuo Handa wrote:
> On 2018/07/07 20:12, Ingo Molnar wrote:
>>
>> * Tetsuo Handa wrote:
>>
>>> From: Tetsuo Handa
>>>
>>> Since syzbot is confused by concurrent printk() messages [1],
>>> this patch changes show_opcodes() to use snprintf().
>>>
>>> When we start adding pref
On 2018-07-17 15:53, Tetsuo Handa wrote:
> On 2018/07/17 18:01, Rasmus Villemoes wrote:
>> Why not this instead? Less stack use, less code, no intermediary
>> snprintfs, no pr_cont...
>
> Excellent! I didn't notice %ph extension.
>
>> Not compile-tested, proba
When I added CONFIG_MODPROBE_PATH, I neglected to update
Documentation/. It's still true that this defaults to /sbin/modprobe,
but now via a level of indirection. So document that the kernel might
have been built with something other than /sbin/modprobe as the
initial value.
Signed-off-by: R
On 31/03/2021 20.47, Matthew Wilcox (Oracle) wrote:
> +static inline void folio_build_bug(void)
> +{
> +#define FOLIO_MATCH(pg, fl) \
> +BUILD_BUG_ON(offsetof(struct page, pg) != offsetof(struct folio, fl));
> +
> + FOLIO_MATCH(flags, flags);
> + FO
On 06/04/2021 15.31, Andy Shevchenko wrote:
> kernel.h is being used as a dump for all kinds of stuff for a long time.
> Here is the attempt to start cleaning it up by splitting out panic and
> oops helpers.
Yay.
Acked-by: Rasmus Villemoes
> At the same time convert users in he
Ensure that lcm(a,b) returns the mathematically correct result,
provided it fits in an unsigned long. The current version returns
garbage if a*b overflows, even if the final result would fit.
Signed-off-by: Rasmus Villemoes
---
lib/lcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion
Return the mathematically correct answer when an argument is 0.
Signed-off-by: Rasmus Villemoes
---
lib/lcm.c | 6 ++
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/lcm.c b/lib/lcm.c
index 01b3aa922dda..51cc6b13cd52 100644
--- a/lib/lcm.c
+++ b/lib/lcm.c
@@ -8,9 +8,7
The idiom 'return a - b;' often used in comparison functions is wrong
unless one is certain the values being compared lie in a sufficiently
small range. In this case dapm_seq_compare would also return 0 if the
->dapm pointers happened to differ by a multiple of 2^32.
Signed-o
than a. One can also easily find three values
a,b,c such that a compares less than b, b compares less than c, but a
does not compare less than c.
Signed-off-by: Rasmus Villemoes
---
fs/hfs/catalog.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/fs/hfs
Now that all in-tree users of strnicmp have been converted to
strncasecmp, the wrapper can be removed.
Signed-off-by: Rasmus Villemoes
---
Notes:
For 3.20.
The "#undef __HAVE_ARCH_STRNICMP" in arch/s390/include/asm/string.h is
a no-op, so removing it should be ok
On Mon, Jan 05 2015, "Zheng, Lv" wrote:
> Hi,
>
>> From: Rasmus Villemoes [mailto:li...@rasmusvillemoes.dk]
>> Sent: Friday, December 12, 2014 6:51 PM
>> To: Zheng, Lv
>> Cc: Rasmus Villemoes; linux-a...@vger.kernel.org; de...@acpica.org;
>> linux
Assigning ddata->invert_polarity to itself is not very useful; the
context suggests that the right-hand side should have been
pdata->invert_polarity.
Signed-off-by: Rasmus Villemoes
---
drivers/video/fbdev/omap2/displays-new/connector-analog-tv.c | 2 +-
1 file changed, 1 insertion
cmp is actually a memcmp (except for the signature and
that bytes are not necessarily treated as unsigned char); since only
the boolean value of the result is used we can just replace
de4x5_strncmp with memcmp.
Signed-off-by: Rasmus Villemoes
---
Notes:
I don't know if the comment mean
long)o1->len - (long long)o2->len;
but I'd rather eliminate the usually broken 'return a - b;' idiom.
Signed-off-by: Rasmus Villemoes
---
Notes:
How this could ever have worked is beyond me - compare_blob seems to
be used to maintain an rbtree, and I wouldn't ex
slightly subtle and since returning
hash - kn->hash in the first place is only ok because the hashes are
restricted to 31 bits, add a comment explaining that.
Signed-off-by: Rasmus Villemoes
---
fs/kernfs/dir.c | 11 +--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git
long)o1->len - (long long)o2->len;
but I'd rather eliminate the usually broken 'return a - b;' idiom.
Reviewed-by: Jeff Layton
Cc:
Signed-off-by: Rasmus Villemoes
---
Notes:
How this could ever have worked is beyond me - compare_blob seems to
be used to maintain an rbtr
ns 0, falsely reporting a match to the
caller.
Technically 'hash - kn->hash' is ok since the hashes are restricted to
31 bits, but it's better to avoid that subtlety.
Signed-off-by: Rasmus Villemoes
---
Notes:
v2: Also use explicit < > comparisons of the hashes.
fs/k
If u and v both represent negative integers and their limb counts
happen to differ, mpi_cmp will always return a positive value - this
is obviously bogus. u is smaller than v if and only if it is larger in
absolute value.
Signed-off-by: Rasmus Villemoes
---
lib/mpi/mpi-cmp.c | 2 +-
1 file
s ok since mpihelp_cmp returns {-1,0,1};
-INT_MIN==INT_MIN won't bite us.
Signed-off-by: Rasmus Villemoes
---
lib/mpi/mpi-cmp.c | 8 +++-
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index 3801694240d8..d25e9e96c310 100644
--- a/lib/mpi/mpi-
On Sun, Dec 07 2014, Julia Lawall wrote:
> Replace a misspelled function name by %s and then __func__.
>
> The function name begins with pci, not cpci.
...
> result = cpci_hotplug_init(debug);
> if (result) {
> - err("cpci_hotplug_init with error %d\n", result);
> +
->stolen->start has type unsigned long; relying on the difference
(effectively cast to int) for sorting is wrong.
Signed-off-by: Rasmus Villemoes
---
drivers/gpu/drm/i915/i915_debugfs.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_deb
On Mon, Dec 22 2014, Andrew Morton wrote:
> On Mon, 22 Dec 2014 20:05:09 +0100 Fabian Frederick wrote:
>
>>
>> -replay_map = kzalloc(sizeof(struct ocfs2_replay_map) +
>> - (osb->max_slots * sizeof(char)), GFP_KERNEL);
>> +replay_map = kzalloc(sizeof(struct ocfs2
The sort function and its helpers don't do memory allocation, so the
slab.h include is redundant. Move it inside the #if 0 protecting the
self-test, similar to how it is done in lib/list_sort.c. This removes
over 450 lines from the generated dependency file.
Signed-off-by: Rasmus Vill
Removing this include produces byte-identical output, and thus removes
a false dependency.
Signed-off-by: Rasmus Villemoes
---
lib/genalloc.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/genalloc.c b/lib/genalloc.c
index 2e65d206b01c..17d8f58f6716 100644
--- a/lib/genalloc.c
+++ b/lib
We don't need all the stuff kernel.h pulls in; just compiler.h since
export.h doesn't do necessary #includes. This removes more than 100
dependencies.
Signed-off-by: Rasmus Villemoes
---
lib/lcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/lcm.c b/lib/l
stmp_device.c only needs EXPORT_SYMBOL, so just include compiler.h and
export.h instead of the whole module.h machinery.
Signed-off-by: Rasmus Villemoes
---
lib/stmp_device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/stmp_device.c b/lib/stmp_device.c
index
strncpy_from_user.c only needs EXPORT_SYMBOL, so just include
compiler.h and export.h instead of the whole module.h machinery.
Signed-off-by: Rasmus Villemoes
---
lib/strncpy_from_user.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/strncpy_from_user.c b/lib
The file doesn't seem to use anything from linux/user_namespace.h, and
removing it yields byte-identical object code and strictly fewer
dependencies in the .cmd file.
Signed-off-by: Rasmus Villemoes
---
lib/kobject_uevent.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/lib/kobject_uev
.
Signed-off-by: Rasmus Villemoes
---
lib/percpu_ida.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/lib/percpu_ida.c b/lib/percpu_ida.c
index 93d145e5539c..f75715131f20 100644
--- a/lib/percpu_ida.c
+++ b/lib/percpu_ida.c
@@ -19,13 +19,10 @@
#include
#include
#include
-#include
Removing the include of linux/spinlock.h produces byte-identical
output for {allno,def}config, and identical objdump -d output for
allyesconfig. In the former two cases, more than a 100 lines are
eliminated from the generated dependency file.
Signed-off-by: Rasmus Villemoes
---
lib/plist.c | 1
The comment helpfully explains why hardirq.h is included, but since
2d4b84739f0a ("hardirq: Split preempt count mask definitions")
in_interrupt() has been provided by preempt_mask.h. Use that instead,
saving around 40 lines in the generated dependency file.
Signed-off-by: Rasmus
show_mem.c doesn't use anything from nmi.h. Removing it yields
identical objdump -d output for each of {allyes,allno,def}config and
eliminates more than 100 lines in the dependency file.
Signed-off-by: Rasmus Villemoes
---
lib/show_mem.c | 1 -
1 file changed, 1 deletion(-)
diff --git
nlattr.c doesn't seem to rely on anything from netdevice.h. Removing
it yields identical objdump -d output for each of {allyes,allno,def}config,
and eliminates more than 200 lines from the generated dependency file.
Signed-off-by: Rasmus Villemoes
---
lib/nlattr.c | 1 -
1 file chang
idr.c doesn't seem to use anything from hardirq.h (or anything
included from that). Removing it produces identical objdump -d output,
and gives 44 fewer lines in the .idr.o.cmd dependency file.
Signed-off-by: Rasmus Villemoes
---
lib/idr.c | 1 -
1 file changed, 1 deletion(-)
diff --git
This file doesn't seem to use anything provided by linux/interrupt.h
or anything recursively included through that. Removing it produces
byte-identical output, while reducing .llist.o.cmd from 541 to 156
lines.
Signed-off-by: Rasmus Villemoes
---
lib/llist.c | 1 -
1 file changed, 1 del
md5.c doesn't use anything from kernel.h, except that that pulls in
compiler.h, which is needed for the export.h to work.
Signed-off-by: Rasmus Villemoes
---
lib/md5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/md5.c b/lib/md5.c
index 958a3c15923c..bb0cd01
file .sort.o.cmd.
Signed-off-by: Rasmus Villemoes
---
lib/sort.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/sort.c b/lib/sort.c
index 926d00429ed2..14fc1dfadb3f 100644
--- a/lib/sort.c
+++ b/lib/sort.c
@@ -4,8 +4,8 @@
* Jan 23 2005 Matt Mackall
*/
-#in
mic_debug.h, but only if
!CONFIG_DYNAMIC_DEBUG, so just include it explicitly (for memset).
objdump -d says the generated code is the same, and wc -l says that
lib/.list_sort.o.cmd went from 579 to 165 lines.
Signed-off-by: Rasmus Villemoes
---
lib/list_sort.c | 7 +--
1 file changed, 5
/types.h in order for gcc not to complain
about unknown types.
Signed-off-by: Rasmus Villemoes
---
include/linux/cryptohash.h | 2 ++
lib/halfmd4.c | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/include/linux/cryptohash.h b/include/linux/cryptohash.h
index
The file uses nothing from init.h, and also doesn't need the full
module.h machinery; export.h is sufficient. The latter requires the
user to ensure compiler.h is included, so do that explicitly instead
of relying on some other header pulling it in.
Signed-off-by: Rasmus Villemoes
---
gain from removing includes
from .h files, but that is of course at the same time a huge can of
worms, involving boatloads of tree-wide patches updating users to
include what they use directly. So before I start doing that, I'd like
to hear if people think it would be futile.
Rasmus Villemo
The file doesn't use anything from ctype.h. Instead of module.h, just
use export.h for EXPORT_SYMBOL. The latter requires the user to
include compiler.h, so do that explicitly instead of relying on some
other header pulling it in.
Signed-off-by: Rasmus Villemoes
---
lib/dynamic_queue_lim
s can pass their u8
or __le32 buffers without a cast.
Furthermore, this allows us to simply let bitmap_copy_le be an alias
for bitmap_copy on little-endian; see next patch.
Signed-off-by: Rasmus Villemoes
---
include/linux/bitmap.h | 2 +-
lib/bitmap.c | 9 -
2 files changed, 5
On little-endian, there's no reason to have an extra, presumably less
efficient, way of copying a bitmap.
Signed-off-by: Rasmus Villemoes
---
include/linux/bitmap.h | 4
lib/bitmap.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/include/linux/bitmap.h b/include/
I'm pretty sure this wasn't supposed to be dead code.
Signed-off-by: Rasmus Villemoes
---
tools/perf/tests/sample-parsing.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/tests/sample-parsing.c
b/tools/perf/tests/sample-parsing.c
index 4908c648a597..30
rks equally well for 8 and 16 bit types.
Signed-off-by: Rasmus Villemoes
---
drivers/hwmon/ad7314.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/hwmon/ad7314.c b/drivers/hwmon/ad7314.c
index f4f9b219bf16..11955467fc0f 100644
--- a/drivers/hwmon/ad7314.c
+++ b/driv
data->temp[index] has type s16. Because of C's promotion rules,
(data->temp[index] << 7) >> 7 is exactly the same as
data->temp[index]. The intention was to use bit 8 as a sign bit, so do
that using the existing API.
Signed-off-by: Rasmus Villemoes
---
drivers/hwmon/ad
The comment explains the intention, but vid has type u16. Before the
inner shift, it is promoted to int, which has plenty of space for all
vid's bits, so nothing is dropped. Use a simple mask instead.
Signed-off-by: Rasmus Villemoes
---
drivers/net/ethernet/intel/fm10k/fm10k_pf.c | 2 +-
1
xtend32 works equally well for 8 and 16 bits types, so
use that.
Signed-off-by: Rasmus Villemoes
---
drivers/staging/iio/resolver/ad2s1200.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/iio/resolver/ad2s1200.c
b/drivers/staging/iio/resolver/ad2s1200.c
in
The intention is obviously to sign-extend a 12 bit quantity. But
because of C's promotion rules, the assignment is equivalent to "val16
&= 0xfff;". Use the proper API for this.
Signed-off-by: Rasmus Villemoes
---
drivers/iio/imu/adis16400_core.c | 3 ++-
1 file changed,
'foo |= X;'.
In the atl2 case, gcc does know how to merge the new adjacent
operations, so altogether this gives a nice little code size
reduction of about 80 bytes.
Signed-off-by: Rasmus Villemoes
---
drivers/net/ethernet/atheros/atlx/atl1.c | 3 +--
drivers/net/ethernet/atheros/atlx
On Mon, Jan 19 2015, Yury Norov wrote:
> New implementation takes less space, and, I hope, easier to understand.
>
> Signed-off-by: Yury Norov
> ---
> lib/find_next_bit.c | 265
> +++-
> 1 file changed, 73 insertions(+), 192 deletions(-)
>
That
On Sat, Jan 24 2015, "Vick, Matthew" wrote:
> Good catch! I noticed this too and was getting a patch together to address
> this.
>
> The difference is that I was planning on not silently accepting an invalid
> VLAN ID to begin with and returning FM10K_ERR_PARAM if the VLAN was
> invalid, which I
On Wed, Jan 14 2015, Calvin Owens wrote:
> Commit b76437579d1344b6 ("procfs: mark thread stack correctly in
> proc//maps") introduced logic to mark thread stacks with the
> "[stack:%d]" marker in /proc//maps.
>
> This causes reading /proc//maps to take O(N^2) time, where N is
> the number of thre
On Wed, Jan 14 2015, Siddhesh Poyarekar wrote:
> On 14 January 2015 at 19:43, Rasmus Villemoes
> wrote:
>> Just thinking out loud: Could one simply mark a VMA as being used for
>> stack during the clone call (is there room in vm_flags, or does
>> VM_GROWSDOWN alre
Instead of potentially passing over the string twice in case c is not
found, just keep track of the last occurrence. According to
bloat-o-meter, this also cuts the generated code by a third (54 vs 36
bytes). Oh, and we get rid of those 7-space indented lines.
Signed-off-by: Rasmus Villemoes
On Wed, Jan 14 2015, Andrew Morton wrote:
> On Wed, 14 Jan 2015 13:03:26 -0800 Calvin Owens wrote:
>>
>> If I understand the current behavior, the "[stack]" marker will get put
>> next to *any* mapping that encompasses the current value in the task's
>> %sp, regardless of how the mapping was cr
Actual kernel buffers can't wrap into the user address space. If
someone manages to pass a buf/size combination that wraps, it is most
likely due to a bug in the caller. Instead of trying to fix it by
using a smaller part of the buffer, bail out.
Signed-off-by: Rasmus Villemoes
---
On 64 bit, size may very well be huge even if bit 31 happens to be
0. Somehow it doesn't feel right that one can pass a 5 GiB buffer but
not a 3 GiB one. So cap at INT_MAX as was probably the intention all
along. This is also the made-up value passed by sprintf and vsprintf.
Signed-off-by: R
All callers of skip_atoi have already checked for the first character
being a digit. In this case, gcc generates simpler code for a do
while-loop.
Signed-off-by: Rasmus Villemoes
---
lib/vsprintf.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/vsprintf.c b/lib
It seems a little simpler to consume the p from a %p specifier in
format_decode, just as it is done for the surrounding %c, %s and %%
cases.
While there, delete a redundant and misplaced comment.
Signed-off-by: Rasmus Villemoes
---
lib/vsprintf.c | 7 +++
1 file changed, 3 insertions(+), 4
The macro MPN_COPY_INCR this occurs in isn't used anywhere.
Signed-off-by: Rasmus Villemoes
---
Another small thing I stumbled on.
lib/mpi/mpi-internal.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/mpi/mpi-internal.h b/lib/mpi/mpi-internal.h
index 60cf765
ed as equal.
Signed-off-by: Rasmus Villemoes
---
drivers/net/wireless/atmel.c | 12 +---
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 9183f1cf89a7..55db9f03eb2a 100644
--- a/drivers/net/wireless/atmel.c
a few useless instructions might be worthwhile.
Signed-off-by: Rasmus Villemoes
---
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 5 +
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index
unsigned - this cuts another few
instructions from the generated code.
Signed-off-by: Rasmus Villemoes
---
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
b/drivers/infiniband/hw/ocrdma
On Fri, Jan 16 2015, Andrew Morton wrote:
> On Fri, 16 Jan 2015 11:23:57 -0500 Johannes Weiner wrote:
>
>> Hi Rasmus,
>>
>> I have trouble booting my test machine with this patch in -mm:
>>
>> commit bb2e066c6943e62e9650bb129f416dacf138f8b1
>> Autho
on the stack, that might as well be done up
here.
Signed-off-by: Rasmus Villemoes
---
Notes:
I don't know how expensive it is to do the symbol lookup for each
initcall. It might be worthwhile adding an
if (list_empty(&blacklisted_initcalls))
return false;
vsnprintf would still not reflect the
actual size needed. For %pE, this requires a change of semantics of
string_escape_mem and hence an annoyingly large diffstat.
Whether this is 3.20, 3.21 and/or -stable material (or /dev/null
material, for that matter ;-)) I'll leave to others to decide.
R
eems to work.
In test-string_helpers.c, I removed the now meaningless -ENOMEM test,
and replaced it with testing for getting the expected return value
even if the buffer is too small. Also ensure that nothing is written
when osz==0.
In net/sunrpc/cache.c, I think qword_add still has the same
semantic
On Wed, Jan 28 2015, Andy Shevchenko wrote:
> On Wed, 2015-01-28 at 14:25 +0100, Rasmus Villemoes wrote:
>> The helper hex_string() is broken in two ways. First, it doesn't
>> increment buf regardless of whether there is room to print, so callers
>> such as kasprin
P_KERNEL, "%14ph",
"CrashBoomBang").
Nobody seems to be using %ph with kasprintf, but we might as well fix
it before it hits someone.
Signed-off-by: Rasmus Villemoes
---
lib/vsprintf.c | 23 ++-
1 file changed, 18 insertions(+), 5 deletions(-)
diff
list_entry is just a wrapper for container_of, but it is arguably
wrong (and slightly confusing) to use it when the pointed-to struct
member is not a struct list_head. Use container_of directly instead.
Signed-off-by: Rasmus Villemoes
---
Most of these predate git. If I'm the only one wh
On Wed, Mar 11 2015, Andrew Morton wrote:
> On Wed, 11 Mar 2015 00:01:11 +0100 Rasmus Villemoes
> wrote:
>> Test and verification code on github
>> <https://github.com/Villemoes/dec>. It would be nice if someone could
>> verify the code on architectures oth
load/store pair. It also shaves 16 bytes of
.text.
Signed-off-by: Rasmus Villemoes
---
lib/vsprintf.c | 10 --
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index e0bea9e5bbbf..7078d90c187b 100644
--- a/lib/vsprintf.c
+++ b/lib/vspri
On Thu, Mar 19 2015, Alexey Dobriyan wrote:
> On Wed, Mar 18, 2015 at 1:04 AM, Andrew Morton
> wrote:
>> On Mon, 16 Mar 2015 18:19:41 +0300 Alexey Dobriyan
>> wrote:
>>
>>> Rasmus, I redid benchmarks:
>>
>> tl;dr ;) Is this an ack or a nack?
>
> New code executes slower for some input on one
mit-struct-debug-baseonly.
This increases the size of .debug_info by ~0.3%, but these 90 KB
contain some rather useful info.
Signed-off-by: Rasmus Villemoes
---
lib/Makefile | 3 +++
lib/debug_info.c | 27 +++
2 files changed, 30 insertions(+)
create mode
On Wed, Apr 22 2015, Gavin Guo wrote:
> /*
> + * The kmalloc_names is for temporary usage to make
> + * slub_debug=,kmalloc-xx option work in the boot time. The
> + * kmalloc_index() support to 2^26=64MB. So, the final entry of the
> + * table is kmalloc-67108864.
> +
The first is a keyboard-off-by-one, the other two the ordinary mathy
kind.
Signed-off-by: Rasmus Villemoes
---
include/linux/slab.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index ffd24c830151..a99f0e5243e1 100644
--- a
301 - 400 of 1998 matches
Mail list logo