On 12/04/2019 11.05, Colin King wrote:
> From: Colin Ian King
>
> Currently the qedf_dbg_* family of functions can overrun the end
> of the source string if it is less than the destination buffer
> length because of the use of a fixed sized memcpy. Replace the
> memset/memcpy calls with the safer
On 2018-04-18 23:21, Linus Torvalds wrote:
> On Wed, Apr 18, 2018 at 1:12 AM, Martin Wilck wrote:
>>
>> No, it doesn't (gcc 7.3.0). -> https://paste.opensuse.org/27471594
>> It doesn't even warn on an expression like this:
>>
>> #define SIZE (1<<10)
>> static int foo[ilog2(SIZE)];
>
> Ok, I t
This saves a little .text and gets rid of the unmotivated line break and
the sizeof(...) style inconsistency.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/fnic/fnic_fcs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic
From: Rasmus Villemoes
iscsi_parse_pr_out_transport_id launders the const away via a call to
strstr(), and then modifies the buffer (writing a nul byte) through
the return value. It's cleaner to be honest and simply declare the
parameter as "char*", fixing up the call chain, and
#x27;ve left it
alone for now.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/hpsa.c | 40 +---
1 file changed, 13 insertions(+), 27 deletions(-)
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a1d6ab76a514..d74268ffb71e 100644
--- a/drivers/sc
On Tue, Jul 05 2016, Markus Mayer wrote:
> Add a collection of generic functions to convert strings to lowercase
> or uppercase.
>
> Changing the case of a string (with or without copying it first) seems
> to be a recurring requirement in the kernel that is currently being
> solved by several dup
On Fri, Jul 01 2016, Markus Mayer wrote:
> Add a function called strtolower() to convert strings to lower case
> in-place, overwriting the original string.
>
> This seems to be a recurring requirement in the kernel that is
> currently being solved by several duplicated implementations doing the
>
There's little point in breaking these strings over multiple lines.
Signed-off-by: Rasmus Villemoes
Reviewed-by: Hannes Reinecke
---
drivers/scsi/constants.c | 27 +--
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/drivers/scsi/constants.c b/drivers
ONSTANTS=y costs
around 75 KB, but that was a little exaggerated. The actual number was
closer to 44K, and 36K with this patch.
Signed-off-by: Rasmus Villemoes
Reviewed-by: Hannes Reinecke
Tested-by: Douglas Gilbert
---
drivers/scsi/Kconfig | 4 ++--
drivers/scsi/consta
This is a purely mechanical move of the list of additional sense codes
to a separate file, in preparation for reducing the impact of choosing
CONFIG_SCSI_CONSTANTS=y by about 8k.
Signed-off-by: Rasmus Villemoes
Reviewed-by: Hannes Reinecke
---
drivers/scsi/constants.c | 830
about 36 KB, while it was about 44 KB
before. I took the liberty of including Hannes' Reviewed-by and
Douglas' Tested-by despite that addition.
Rasmus Villemoes (3):
scsi: make some Additional Sense strings more grep'able
scsi: move Additional Sense Codes to separate
On Tue, Nov 24 2015, Rasmus Villemoes wrote:
> This reduces the impact of choosing CONFIG_SCSI_CONSTANTS by about 8KB.
>
ping? does anyone feel like picking these up?
Rasmus
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a m
ch simpler (and generates smaller code)
to use the %ph extension which was created for such short hexdumps.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/osd/osd_initiator.c | 5 +
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/scsi/osd/osd_initiator.c b/driver
There's little point in breaking these strings over multiple lines.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/constants.c | 27 +--
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
: 0/0 grow/shrink: 1/1 up/down: 24/-8488 (-8464)
function old new delta
scsi_extd_sense_format 136 160 +24
additional 113122824 -8488
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/c
8K delta, however).
Tested with a trivial module calling scsi_extd_sense_format with a few
random known codes and comparing the result to the expected value.
v2: prepend patch to unsplit a few string literals for greppability,
leave the NULL sentinel in the .c file in 2/3 (it's removed in 3/3
ei
This is a purely mechanical move of the list of additional sense codes
to a separate file, in preparation for reducing the impact of choosing
CONFIG_SCSI_CONSTANTS=y by about 8k.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/constants.c | 830
On Wed, Oct 28 2015, Don Brace wrote:
> On 10/27/2015 05:16 PM, Rasmus Villemoes wrote:
>> I'm not familiar with this code, but path_info_show() (added in
>> 8270b86243658 "hpsa: add sysfs entry path_info to show box and
>> bay information") seems to
On Wed, Nov 04 2015, James Bottomley
wrote:
> On Wed, 2015-11-04 at 00:26 +0100, Rasmus Villemoes wrote:
>> On Tue, Nov 03 2015, James Bottomley
>> wrote:
>> >> Please spell it U32_MAX
>> >
>> > Why? there's no reason not to use the arithmeti
On Tue, Nov 03 2015, James Bottomley
wrote:
> On Tue, 2015-11-03 at 23:13 +0100, Rasmus Villemoes wrote:
>> On Tue, Nov 03 2015, James Bottomley
>> wrote:
>>
>> > From: James Bottomley
>> >
>> > It was noticed that we lose precision in the f
size.
>
> Reported-by: Vitaly Kuznetsov
> Cc: sta...@vger.kernel.org# delay backport by two months for testing
> Fixes: b9f28d863594c429e1df35a0474d2663ca28b307
> Signed-off-by: James Bottomley
>
> --
>
> v2: updated with a recommendation from Rasmus Villemoes to truncate the
> in
buffer, which the upper
layer guarantees is at least PAGE_SIZE. s[c]nprintf doesn't care where
it is writing to, so this doesn't make the spin lock hold time any
longer. Using scnprintf ensures that output_len always represents the
number of bytes actually written t
On Tue, Oct 06 2015, Rasmus Villemoes wrote:
> On Mon, Oct 05 2015, Bart Van Assche wrote:
>
>> On 10/05/15 02:26, Rasmus Villemoes wrote:
>>> - {0x041A, "Logical unit not ready, start stop unit command in "
>>> -"progress"},
>>>
On Tue, Oct 06 2015, Julian Calaby wrote:
> Hi Rasmus,
>
>>
>> diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c
>> index 47aaccd5e68e..ccd34b0481cd 100644
>> --- a/drivers/scsi/constants.c
>> +++ b/drivers/scsi/constants.c
>> @@ -292,17 +292,31 @@ bool scsi_opcode_sa_name(int opco
On Mon, Oct 05 2015, Bart Van Assche wrote:
> On 10/05/15 02:26, Rasmus Villemoes wrote:
>> struct error_info {
>> unsigned short code12; /* 0x0302 looks better than 0x03,0x02 */
>> -const char * text;
>> +unsigned short size;
>> };
>
On Mon, Oct 05 2015, Bart Van Assche wrote:
> On 10/05/15 02:26, Rasmus Villemoes wrote:
>> -{0x041A, "Logical unit not ready, start stop unit command in "
>> - "progress"},
>> -{0x041B, "Logical unit not ready, sanitize in progre
: 0/0 grow/shrink: 1/1 up/down: 24/-8488 (-8464)
function old new delta
scsi_extd_sense_format 136 160 +24
additional 113122824 -8488
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/c
This is a purely mechanical move of the list of additional sense codes
to a separate file, in preparation for reducing the impact of choosing
CONFIG_SCSI_CONSTANTS=y by about 8k..
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/constants.c | 839
8K delta, however).
Tested with a trivial module calling scsi_extd_sense_format with a few
random known codes and comparing the result to the expected value.
Rasmus Villemoes (2):
scsi: move Additional Sense Codes to separate file
scsi: reduce CONFIG_SCSI_CONSTANTS=y impact by 8k
136 160 +24
additional 11312 2824 -8488
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/constants.c | 25 +
drivers/scsi/sense_codes.h | 2 --
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/drivers/s
This saves a little .text and avoids the sizeof(...) style
inconsistency.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/fnic/fnic_fcs.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index bf0bbd42efb5
e two arrays in sync.
$ scripts/bloat-o-meter /tmp/vmlinux vmlinux
add/remove: 2/1 grow/shrink: 1/0 up/down: 7073/-11312 (-4239)
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/constants.c | 21 +++--
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers
On Mon, Sep 21 2015, Maurizio Lombardi wrote:
> Hi Rasmus,
>
> On 09/16/2015 10:35 PM, Rasmus Villemoes wrote:
>>
>> I just remembered: I noticed a while ago that the qualifier member is
>> only used inside format_decode (in the end, the information is folded
>&
Mentioning the enclosing function twice doesn't add value.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/3w-.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/3w-.c b/drivers/scsi/3w-.c
index c75f2048319f..67539e73fdad 100644
--- a/drivers/sc
ly to fail spectacularly.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/megaraid/megaraid_sas_base.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c
b/drivers/scsi/megaraid/megaraid_sas_base.c
index ff283d23788a..e7c6b9c946d6 100644
---
On Thu, Jan 29 2015, Finn Thain wrote:
> I have one reservation about this patch series.
>
> For example, the changes,
>
> - seq_printf(m, "%s", p);
> + seq_puts(m, p);
>
> These calls are not equivalent because the bounds check is not the same.
> seq_puts will fail when m->count + strle
On Wed, Dec 03 2014, Rasmus Villemoes wrote:
> These patches mostly replace seq_printf with simpler and faster
> equivalents, e.g. seq_printf(m, "something") => seq_puts(m,
> "something") and seq_printf(m, "\n") => seq_putc(m, '\n). But before
&
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/advansys.c | 155 +++-
1 file changed, 75
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/BusLogic.c | 10 +-
drivers/scsi/NCR5380.c | 4
The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/NCR5380.c | 20 ++-
drivers/scsi/aha152x.c
Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/advansys.c | 43 +++
drivers/scsi/atp870u.c | 5 ++---
drivers/scsi/dc395x.c| 4
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/aha152x.c | 248 -
1 file changed, 124
Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/NCR5380.c | 2 +-
drivers/scsi/advansys.c | 34
an
unnecessary macro.
The patches don't change the semantics of the code (well, that's the
idea anyway), but should make it slightly smaller and faster.
v2: Redone on top of git://git.infradead.org/users/hch/scsi-queue.git
drivers-for-3.19
Rasmus Villemoes (6):
scsi: Remove SPRINTF macr
The macros PRINTP/ANDP make the code harder to read and depend on a
specific identifier name in the surrounding scope. Nuke them.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/g_NCR5380.c | 66 ++--
1 file changed, 30 insertions(+), 36 deletions
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/advansys.c | 157
1 file changed, 77
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/aha152x.c | 252 -
1 file changed, 126
Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/BusLogic.c | 10 +-
drivers/scsi/NCR5380.c | 6
Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/advansys.c | 40 ++--
drivers/scsi/atp870u.c | 5 ++---
drivers/scsi/dc395x.c| 4
Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/NCR5380.c | 2 +-
drivers/scsi/advansys.c | 34
The macro SPRINTF doesn't save a lot of typing or make the code more
readable, and depending on a specific identifier (m) in the
surrounding scope is generally frowned upon. Nuke it.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/NCR5380.c | 42 +++---
drivers/scsi/aha1
unnecessary, and in the PRINTP case quite obfuscating, macros.
The patches don't change the semantics of the code (well, that's the
idea anyway), but should make it slightly smaller and faster.
Rasmus Villemoes (7):
scsi: Remove SPRINTF macro
scsi/g_NCR5380: Remove obfuscating macro
avoid breaking existing users.
To allow the compat wrapper strnicmp to be removed at some point in
the future, and to avoid the extra indirection cost, do
s/strnicmp/strncasecmp/g.
Cc: Adaptec OEM Raid Solutions
Cc: "James E.J. Bottomley"
Cc: linux-scsi@vger.kernel.org
Signed-off-
The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under
drivers/scsi/ contain two-thirds of an include guard, but do not
#define the macro. Add those #defines. git grep says the macro names
are not defined elsewhere.
Signed-off-by: Rasmus Villemoes
---
For good measure, here's a ve
Rasmus Villemoes writes:
> The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under
> drivers/scsi/ contain two-thirds of an include guard, but do not
> elsewhere.
>
Argh, git commit ate a line because it happened to start with #. This
was supposed to be something like &q
Clearly the file was meant to contain an include guard, but it was
missing the #define part.
Signed-off-by: Rasmus Villemoes
---
drivers/target/target_core_ua.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/target/target_core_ua.h b/drivers/target/target_core_ua.h
index be912b3
The four files aha1542.h, aha1740.h, gvp11.h and mvme147.h under
drivers/scsi/ contain two-thirds of an include guard, but do not
elsewhere.
Signed-off-by: Rasmus Villemoes
---
drivers/scsi/aha1542.h | 1 +
drivers/scsi/aha1740.h | 1 +
drivers/scsi/gvp11.h | 1 +
drivers/scsi/mvme147.h | 1
Joe Lawrence writes:
> On Tue, 1 Jul 2014, Rasmus Villemoes wrote:
>
>> Rounding up to a multiple of 4 should be done using the ALIGN
>> macro. As a bonus, this also makes the generated code smaller.
>>
>> In GetIocFacts(), sz is assigned to a few lines belo
mageSize.
Signed-off-by: Rasmus Villemoes
---
drivers/message/fusion/mptbase.c | 7 +--
drivers/message/fusion/mptctl.c | 7 +--
2 files changed, 2 insertions(+), 12 deletions(-)
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index ebc0af7..10b16a1 1006
59 matches
Mail list logo