Re: [2/4] scsi: hpsa: Less function calls in hpsa_big_passthru_ioctl() after error detection

2018-03-24 Thread SF Markus Elfring
>> @@ -6501,14 +6501,16 @@ static int hpsa_big_passthru_ioctl(struct ctlr_info >> *h, void __user *argp) >> cleanup0: >> cmd_free(h, c); >> cleanup1: >> - if (buff) { >> + { >> int i; >> >> for (i = 0; i < sg_used; i++) >>

[PATCH 4/4] scsi: hpsa: Move a variable assignment in hpsa_big_passthru_ioctl()

2018-03-05 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 4 Mar 2018 22:16:05 +0100 Move an assignment for the local variable "sg_used" so that its setting will only be performed after corresponding memory allocations succeeded by this function. Signed-off-by: Markus Elfring --- drivers/scsi/hpsa.c | 3 ++- 1 file chan

[PATCH 3/4] scsi: hpsa: Delete an unnecessary initialisation in hpsa_big_passthru_ioctl()

2018-03-05 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 4 Mar 2018 22:02:10 +0100 The variable "status" will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/scsi/hpsa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH 2/4] scsi: hpsa: Less function calls in hpsa_big_passthru_ioctl() after error detection

2018-03-05 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 4 Mar 2018 22:00:19 +0100 The function "kfree" was called in a few cases by the hpsa_big_passthru_ioctl() function during error handling even if the passed variable contained a null pointer. * Adjust jump targets. * Delete two initialisations and a check (for the

[PATCH 1/4] scsi: hpsa: Use memdup_user() rather than duplicating its implementation

2018-03-05 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 4 Mar 2018 21:19:52 +0100 * Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. * Return directly after this function call failed at the beginning. Signed-off-by:

[PATCH 0/4] SCSI-HPSA: Adjustments for hpsa_big_passthru_ioctl()

2018-03-05 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 5 Mar 2018 09:14:32 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (4): Use memdup_user() rather than duplicating its implementation Less function calls in hpsa_big_passthru_ioctl() after error detection

Re: [0/8] target-iSCSI: Adjustments for several function implementations

2018-02-23 Thread SF Markus Elfring
>> Can a passed null pointer really work in this function? >> >> https://elixir.bootlin.com/linux/v4.16-rc2/source/include/crypto/hash.h#L684 >> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/crypto/hash.h?id=0f9da844d87796ac31b04e81ee95e155e9043132#n751 >> >> stati

Re: [0/8] target-iSCSI: Adjustments for several function implementations

2018-02-23 Thread SF Markus Elfring
> Calling crypto_free_shash(NULL) is actually fine. Really? > It doesn't dereference the parameter, it just does pointer math on it in > crypto_shash_tfm() and returns if it's NULL in crypto_destroy_tfm(). Can a passed null pointer really work in this function? https://elixir.bootlin.com/linux

Re: [0/8] target-iSCSI: Adjustments for several function implementations

2018-02-23 Thread SF Markus Elfring
> You're 1/8 patch had an actual bug fix hidden amongst the style churn. It showed the general possibility to adjust the source code structure for the function “chap_server_compute_md5” also because of the usage of the single jump label “out” before. > I don't see any such fixes in the other pat

Re: [PATCH 0/8] target-iSCSI: Adjustments for several function implementations

2018-02-21 Thread SF Markus Elfring
> Date: Tue, 12 Dec 2017 22:22:11 +0100 > > Some update suggestions were taken into account > from static source code analysis. > > Markus Elfring (8): > Less function calls in chap_server_compute_md5() after error detection > Move resetting of seven variables in chap_server_compute_md5() >

[PATCH 8/8] target/iscsi: Improve 16 size determinations

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 22:06:00 +0100 Replace the specification of data types by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detected b

[PATCH 7/8] target/iscsi: Delete an unnecessary variable initialisation in iscsi_set_default_param()

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 21:21:31 +0100 The local variable "param" will be reassigned by a following statement. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file changed, 1

[PATCH 6/8] target/iscsi: Delete an unnecessary variable initialisation in iscsi_create_default_params()

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 21:18:39 +0100 The variable "param" will eventually be set to an appropriate pointer a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file

[PATCH 5/8] target/iscsi: Delete an unnecessary variable initialisation in iscsi_copy_param_list()

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 21:15:55 +0100 The variable "param_list" will be reassigned by a following statement. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 2 +- 1 file changed, 1 i

[PATCH 4/8] target/iscsi: Delete an unnecessary variable initialisation in iscsit_allocate_ooo_cmdsn()

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 21:13:49 +0100 The local variable "ooo_cmdsn" will be reassigned by a following statement. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_erl1.c | 2 +- 1 file changed, 1 in

[PATCH 3/8] target/iscsi: Delete 36 error messages for a failed memory allocation

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 21:07:16 +0100 Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target.c | 2 -- drivers/tar

[PATCH 2/8] target/iscsi: Move resetting of seven variables in chap_server_compute_md5()

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 19:43:47 +0100 Move the resetting of these array variables so that this operation will be performed only if memory allocations succeeded before in this function. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_auth.c | 22

[PATCH 1/8] target/iscsi: Less function calls in chap_server_compute_md5() after error detection

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 18:00:41 +0100 The functions "crypto_free_shash", "kfree" and "kzfree" were called in a few cases by the chap_server_compute_md5() function during error handling even if the passed variable contained a null pointer. * Adjust jump targets according to t

[PATCH 0/8] target-iSCSI: Adjustments for several function implementations

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 22:22:11 +0100 Some update suggestions were taken into account from static source code analysis. Markus Elfring (8): Less function calls in chap_server_compute_md5() after error detection Move resetting of seven variables in chap_server_compute_md5

[PATCH 2/2] target: cxgbit: Combine substrings for 11 messages

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 12:57:47 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: quoted string split across lines Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/target/iscsi/cxgbit/cxgbit_target.c

[PATCH 1/2] target: cxgbit: Delete an error message for a failed memory allocation in two functions

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 11:34:51 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/iscsi/cxgbit/cxgbit_target.c | 8 ++-- 1 file cha

[PATCH 0/2] target/iscsi/cxgbit: Adjustments for seven function implementations

2017-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 12 Dec 2017 13:12:11 +0100 Two update suggestions were taken into account from static source code analysis. Markus Elfring (2): Delete an error message for a failed memory allocation in two functions Combine substrings for 11 messages drivers/target/iscsi/cx

[PATCH 6/6] target: tcm_loop: Use seq_puts() in tcm_loop_show_info()

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 11 Dec 2017 11:01:57 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: Prefer seq_puts to seq_printf Thus fix the affected source code place. Signed-off-by: Markus Elfring --- drivers/target/loopback/tcm_loop.c | 2 +- 1 fil

[PATCH 5/6] target: tcm_loop: Delete an unnecessary return statement in tcm_loop_submission_work()

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 11 Dec 2017 10:58:33 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: void function return statements are not generally useful Thus remove such a statement in the affected function. Signed-off-by: Markus Elfring --- drivers

[PATCH 4/6] target: tcm_loop: Delete two unnecessary variable initialisations in tcm_loop_issue_tmr()

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 11 Dec 2017 10:56:42 +0100 The variables "se_cmd" and "tl_cmd" will eventually be set to appropriate pointers a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/loopback/tcm_loop.c | 4 ++-- 1 fi

[PATCH 3/6] target: tcm_loop: Combine substrings for 26 messages

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 11 Dec 2017 10:40:23 +0100 The script "checkpatch.pl" pointed information out like the following. WARNING: quoted string split across lines Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/target/loopback/tcm_loop.c | 120 +++

[PATCH 2/6] target: tcm_loop: Improve a size determination in two functions

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 10 Dec 2017 21:23:43 +0100 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detec

[PATCH 1/6] target: tcm_loop: Delete an error message for a failed memory allocation in four functions

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 10 Dec 2017 21:18:15 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/loopback/tcm_loop.c | 14 -- 1 file chang

[PATCH 0/6] target/loopback/tcm: Adjustments for some function implementations

2017-12-11 Thread SF Markus Elfring
From: Markus Elfring Date: Mon, 11 Dec 2017 11:33:44 +0100 Some update suggestions were taken into account from static source code analysis. Markus Elfring (6): Delete an error message for a failed memory allocation in four functions Improve a size determination in two functions Combine su

[PATCH] sbp-target: Delete an error message for a failed memory allocation in three functions

2017-12-10 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 10 Dec 2017 19:54:11 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/sbp/sbp_target.c | 13 - 1 file changed,

Re: iSCSI-target: Use common error handling code in iscsi_decode_text_input()

2017-11-06 Thread SF Markus Elfring
>> Add a jump target so that a bit of exception handling can be better reused >> at the end of this function. > > Why not look at what the C compiler generates before making the code > less readable ? * Does the adjusted source code layout fit to information from the section “7) Centralized exi

[PATCH 4/4] target: Delete an error message for a failed memory allocation in two functions

2017-11-04 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 4 Nov 2017 13:43:22 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/target_core_xcopy.c | 10 -- 1 file changed, 4

[PATCH 3/4] target: Improve a size determination in three functions

2017-11-04 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 4 Nov 2017 13:35:08 +0100 Replace the specification of data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. This issue was detect

[PATCH 2/4] target: Combine two condition checks into one statement in target_xcopy_do_work()

2017-11-04 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 4 Nov 2017 13:26:46 +0100 The same label was used by goto statements after two condition checks. Thus use a single statement instead. Signed-off-by: Markus Elfring --- drivers/target/target_core_xcopy.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-)

[PATCH 1/4] target: Use common error handling code in three functions

2017-11-04 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 4 Nov 2017 13:13:20 +0100 Adjust jump targets so that a bit of exception handling can be better reused at the end of these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/target_core_xcopy.c

[PATCH 0/4] target: Adjustments for four function implementations

2017-11-04 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 4 Nov 2017 14:09:09 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (4): Use common error handling code in three functions Combine two condition checks into one statement in target_xcopy_do_work() Impro

[PATCH] iSCSI-target: Use common error handling code in iscsi_decode_text_input()

2017-11-03 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 3 Nov 2017 22:20:38 +0100 Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_param

[PATCH] SCSI-dpt_i2o: Use common error handling code in adpt_hba_reset()

2017-11-02 Thread SF Markus Elfring
From: Markus Elfring Date: Thu, 2 Nov 2017 17:45:14 +0100 * Adjust five function calls together with a variable assignment. * Add a jump target so that a bit of exception handling can be better reused at the end of this function. This issue was detected by using the Coccinelle software. Si

Checking the description for aac_comm_init()

2017-11-02 Thread SF Markus Elfring
Hello, I have taken another look also at the implementation of the function “aac_comm_init”. http://elixir.free-electrons.com/linux/v4.14-rc7/source/drivers/scsi/aacraid/comminit.c#L333 https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/drivers/scsi/aacraid/comminit.c?id=fa8

Re: scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc()

2017-08-26 Thread SF Markus Elfring
>> PS: ufshcd_memory_alloc() also does some DMA coherent memory allocation >> (via dmam_alloc_coherent() APIs) and tries to print out the message on >> allocation failure. Although i don't know "out of memory" messages will >> be printed out by dmam_alloc_coherent() APIs or not. If it does print

[PATCH 3/3] SCSI-sg: Fix a typo in a comment line in sg_ioctl()

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 22:06:59 +0200 Fix a word in this description. Signed-off-by: Markus Elfring --- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 4a2db7ff14cc..c80899d249c6 100644 --- a

[PATCH 2/3] SCSI-sg: Improve a size determination in sg_alloc()

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 21:55:14 +0200 Replace the specification of a data type by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus E

[PATCH 1/3] SCSI-sg: Delete an error message for a failed memory allocation in sg_alloc()

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 21:48:11 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/sg.c | 5 + 1 file changed, 1 insertion(+), 4 deletio

[PATCH 0/3] SCSI-sg: Adjustments for two function implementations

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 22:20:02 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): Delete an error message for a failed memory allocation in sg_alloc() Improve a size determination in sg_alloc() Fix a typo in a

[PATCH] SCSI-sd: Delete an error message for a failed memory allocation in sd_revalidate_disk()

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 21:34:44 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/sd.c | 5 + 1 file changed, 1 insertion(+), 4 deletio

[PATCH] SCSI-scan: Delete an error message for a failed memory allocation in two functions

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 21:17:02 +0200 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/scsi_scan.c | 9 +++-- 1 file changed, 3 insertions

[PATCH] SCSI-devinfo: Delete an error message for a failed memory allocation in scsi_dev_info_list_add_keyed()

2017-08-25 Thread SF Markus Elfring
From: Markus Elfring Date: Fri, 25 Aug 2017 20:54:16 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/scsi_devinfo.c | 4 +--- 1 file changed, 1 insertion(+),

Re: [PATCH 0/5] block-cciss: Fine-tuning for two function implementations

2017-08-06 Thread SF Markus Elfring
> Date: Thu, 18 Aug 2016 11:40:04 +0200 > > Some update suggestions were taken into account > from static source code analysis. > > Markus Elfring (5): > Use memdup_user() > Less function calls after error detection > Delete unnecessary initialisations > Move an assignment for the variabl

Re: Checking error messages for failed memory allocations

2017-04-26 Thread SF Markus Elfring
> Feel free to submit documentation patches. Do involved software developers agree on the functionality for stack dumps because of out of memory situations? Regards, Markus

Re: Checking error messages for failed memory allocations

2017-04-26 Thread SF Markus Elfring
> Basically most everything that has a gfp_t argument does a > dump_stack() on OOM unless __GFP_NOWARN is specified by that gfp_t. How do you think about to improve any programming interface documentation around such a function property? Are there any special checks needed for function implementa

Re: scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc()

2017-04-26 Thread SF Markus Elfring
> Although i don't know "out of memory" messages will be printed out by > dmam_alloc_coherent() APIs > or not. Would such information belong to the programming interface documentation? Are there any related tags or source code annotations needed? Regards, Markus

[PATCH 3/3] scsi: ufs: Delete an unnecessary return statement in ufshcd_exception_event_handler()

2017-04-25 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 25 Apr 2017 22:00:05 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: void function return statements are not generally useful Thus remove such a statement here. Signed-off-by: Markus Elfring --- drivers/scsi/ufs/ufshcd.c |

[PATCH 2/3] scsi: ufs: Delete an error message for a failed memory allocation in ufshcd_memory_alloc()

2017-04-25 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 25 Apr 2017 21:50:43 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus remove such a statement here. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Re

[PATCH 1/3] scsi: ufs: Use devm_kcalloc() in ufshcd_memory_alloc()

2017-04-25 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 25 Apr 2017 21:45:25 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "devm_kcalloc". * Replace the specification of a data structure by a

[PATCH 0/3] SCSI-UFSHCD: Fine-tuning for two function implementations

2017-04-25 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 25 Apr 2017 22:20:02 +0200 Three update suggestions were taken into account from static source code analysis. Markus Elfring (3): Use devm_kcalloc() in ufshcd_memory_alloc() Delete an error message for a failed memory allocation in ufshcd_memory_alloc() Del

[PATCH 5/5] target: Use kmalloc_array() in transport_kmap_data_sg()

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 21:07:14 +0200 A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software.

[PATCH 4/5] target: Use kmalloc_array() in compare_and_write_callback()

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 20:25:11 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle so

[PATCH 3/5] target: Improve size determinations in two functions

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 20:15:12 +0200 Replace the specification of two data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determinations a bit safer according to the Linux coding style convention. Signed-off-by: M

[PATCH 2/5] target: Delete error messages for failed memory allocations

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 19:20:26 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus remove such statements here. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refa

[PATCH 1/5] target: Use kcalloc() in two functions

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 19:02:38 +0200 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. *

[PATCH 0/5] target: Fine-tuning for some function implementations

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 21:33:21 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (5): rd: Use kcalloc() in two functions rd: Delete error messages for failed memory allocations rd: Improve size determinations in two

[PATCH 3/3] iscsi-target: Improve size determinations in four functions

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 16:00:39 +0200 Replace the specification of four data structures by pointer dereferences as the parameter for the operator "sizeof" to make the corresponding size determinations a bit safer according to the Linux coding style convention. Signed-off-by:

[PATCH 2/3] iscsi-target: Delete error messages for failed memory allocations

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 15:34:50 +0200 The script "checkpatch.pl" pointed information out like the following. WARNING: Possible unnecessary 'out of memory' message Thus remove such statements here. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refa

[PATCH 1/3] iscsi-target: Use kcalloc() in iscsit_allocate_iovecs()

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 15:06:00 +0200 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software

[PATCH 0/3] iSCSI-target: Fine-tuning for some function implementations

2017-04-09 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 9 Apr 2017 16:11:23 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (3): Use kcalloc() in iscsit_allocate_iovecs() Delete error messages for failed memory allocations Improve size determinations in four

Re: [PATCH 1/7] aacraid: Use memdup_user() rather than duplicating its implementation

2016-08-22 Thread SF Markus Elfring
>> @@ -526,15 +526,9 @@ static int aac_send_raw_srb(struct aac_dev* dev, void >> __user * arg) >> goto cleanup; >> } >> >> - user_srbcmd = kmalloc(fibsize, GFP_KERNEL); >> - if (!user_srbcmd) { >> - dprintk((KERN_DEBUG"aacraid: Could not make a copy

[PATCH] megaraid_sas: Use memdup_user() rather than duplicating its implementation

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 10:39:04 +0200 Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/megaraid/megaraid_sas_base.c | 11 +++--

[PATCH 7/7] aacraid: Apply another recommendation from "checkpatch.pl"

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 08:23:25 +0200 The script "checkpatch.pl" can point out that assignments should usually not be performed within condition checks. Thus move the assignment for the variable "srbfib" to a separate statement. Signed-off-by: Markus Elfring --- drivers/sc

[PATCH 6/7] aacraid: Improve determination of a few sizes

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 08:04:48 +0200 Replace the specification of data structures by references for variables as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: M

[PATCH 5/7] aacraid: Add spaces after control flow keywords

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 07:10:43 +0200 Keywords which belong to the category "control flow" in the C programming language should be followed by a space character according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/scsi/aacraid/commctrl.

[PATCH 4/7] aacraid: Delete unnecessary braces

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 07:07:08 +0200 Do not use curly brackets at some source code places where a single statement should be sufficient. Signed-off-by: Markus Elfring --- drivers/scsi/aacraid/commctrl.c | 18 ++ 1 file changed, 6 insertions(+), 12 deletion

[PATCH 3/7] aacraid: Delete unnecessary initialisations in aac_send_raw_srb()

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Aug 2016 21:25:20 +0200 Six local variables will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/scsi/aacraid/commctrl.c | 12 ++-- 1 file changed, 6 inserti

[PATCH 2/7] aacraid: One function call less in aac_send_raw_srb() after error detection

2016-08-21 Thread SF Markus Elfring
>From e8187662ee30aab709a260c72fb86c51673f8e0d Mon Sep 17 00:00:00 2001 From: Markus Elfring Date: Sat, 20 Aug 2016 20:40:47 +0200 Subject: [PATCH 2/7] aacraid: One function call less in aac_send_raw_srb() after error detection The kfree() function was called in a few cases by the aac_send_raw_s

[PATCH 1/7] aacraid: Use memdup_user() rather than duplicating its implementation

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 20 Aug 2016 20:05:24 +0200 Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scsi/aacraid/commctrl.c | 12 +++- 1

[PATCH 0/7] aacraid: Fine-tuning for a few functions

2016-08-21 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 21 Aug 2016 09:03:21 +0200 Several update suggestions were taken into account from static source code analysis. Markus Elfring (7): Use memdup_user() rather than duplicating its implementation One function call less in aac_send_raw_srb() after error detection

[PATCH 4/5] block-cciss: Move an assignment for the variable "sg_used" in cciss_bigpassthru()

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 17 Aug 2016 23:04:46 +0200 Move the assignment for the local variable "sg_used" behind the source code for some memory allocations by this function. Signed-off-by: Markus Elfring --- drivers/block/cciss.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)

[PATCH 5/5] block-cciss: Replace three kzalloc() calls by kcalloc()

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Thu, 18 Aug 2016 11:26:18 +0200 * The script "checkpatch.pl" can point information out like the following. WARNING: Prefer kcalloc over kzalloc with multiply Thus fix the affected source code places. * Replace the specification of data structures by pointer deref

[PATCH 3/5] block-cciss: Delete unnecessary initialisations in cciss_bigpassthru()

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 17 Aug 2016 22:55:51 +0200 Three local variables will be set to an appropriate value a bit later. Thus omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/block/cciss.c | 6 +++--- 1 file changed, 3 insertions(+), 3 delet

[PATCH 2/5] block-cciss: Less function calls in cciss_bigpassthru() after error detection

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 17 Aug 2016 22:39:31 +0200 The kfree() function was called in a few cases by the cciss_bigpassthru() function during error handling even if a passed variable contained a null pointer. Adjust jump targets according to the Linux coding style convention. Signed-off-

[PATCH 0/5] block-cciss: Fine-tuning for two function implementations

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Thu, 18 Aug 2016 11:40:04 +0200 Some update suggestions were taken into account from static source code analysis. Markus Elfring (5): Use memdup_user() Less function calls after error detection Delete unnecessary initialisations Move an assignment for the varia

[PATCH 1/5] block-cciss: Use memdup_user() rather than duplicating its implementation

2016-08-18 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 17 Aug 2016 22:10:29 +0200 * Reuse existing functionality from memdup_user() instead of keeping duplicate source code. This issue was detected by using the Coccinelle software. * Return directly if this copy operation failed. Signed-off-by: Markus Elfring -

[PATCH] scsi: Delete an unnecessary check before the function call "kfree"

2016-07-24 Thread SF Markus Elfring
From: Markus Elfring Date: Sun, 24 Jul 2016 14:20:21 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/scs

Re: [PATCH] SCSI-aic94xx: Delete unnecessary checks before the function call "kmem_cache_destroy"

2016-07-24 Thread SF Markus Elfring
> From: Markus Elfring > Date: Tue, 17 Nov 2015 08:14:52 +0100 > > The kmem_cache_destroy() function tests whether its argument is NULL > and then returns immediately. Thus the test around the calls is not needed. > > This issue was detected by using the Coccinelle software. > > Signed-off-by:

[PATCH v2 3/3] xen-scsiback: Pass a failure indication as a constant

2016-07-20 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 20 Jul 2016 13:12:33 +0200 Pass the constant "FAILED" in a function call directly instead of using an intialisation for a local variable. Signed-off-by: Markus Elfring --- v2: Rebased on source files from "Linux next-20160719" drivers/xen/xen-scsiback.c | 4 ++-

[PATCH v2 2/3] xen-scsiback: Rename jump labels in scsiback_device_action()

2016-07-20 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 20 Jul 2016 13:03:16 +0200 * Adjust jump targets according to the Linux coding style convention. * A bit of refactoring for the control flow Suggested-by: Jürgen Groß Signed-off-by: Markus Elfring --- v2: Rebased on source files from "Linux next-20160719" C

[PATCH v2 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree"

2016-07-20 Thread SF Markus Elfring
From: Markus Elfring Date: Tue, 19 Jul 2016 15:42:19 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- v2: Rebased

[PATCH v2 0/3] xen-scsiback: Fine-tuning for scsiback_device_action()

2016-07-20 Thread SF Markus Elfring
From: Markus Elfring Date: Wed, 20 Jul 2016 13:20:04 +0200 Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (3): Delete an unnecessary check before the function call "kfree" Rename jump labels in scsiback_device_act

Re: [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection

2016-07-19 Thread SF Markus Elfring
@@ -606,7 +606,7 @@ static void scsiback_device_action(struct vscsibk_pend *pending_req, tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL); if (!tmr) { target_put_sess_cmd(se_cmd); - goto err; + goto do_resp; } >>>

Re: [PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection

2016-07-19 Thread SF Markus Elfring
>> @@ -606,7 +606,7 @@ static void scsiback_device_action(struct vscsibk_pend >> *pending_req, >> tmr = kzalloc(sizeof(struct scsiback_tmr), GFP_KERNEL); >> if (!tmr) { >> target_put_sess_cmd(se_cmd); >> -goto err; >> +goto do_resp; >> } > > Hmm

[PATCH 3/3] xen-scsiback: Pass a failure indication as a constant

2016-07-16 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 16 Jul 2016 21:55:01 +0200 Pass the constant "FAILED" in a function call directly instead of using an intialisation for a local variable. Signed-off-by: Markus Elfring --- drivers/xen/xen-scsiback.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff

[PATCH 2/3] xen-scsiback: One function call less in scsiback_device_action() after error detection

2016-07-16 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 16 Jul 2016 21:42:42 +0200 The kfree() function was called in one case by the scsiback_device_action() function during error handling even if the passed variable "tmr" contained a null pointer. Adjust jump targets according to the Linux coding style convention. S

[PATCH 1/3] xen-scsiback: Delete an unnecessary check before the function call "kfree"

2016-07-16 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 16 Jul 2016 21:21:05 +0200 The kfree() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/xen

[PATCH 0/3] xen-scsiback: Fine-tuning for scsiback_device_action()

2016-07-16 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 16 Jul 2016 22:06:54 +0200 Further update suggestions were taken into account after a patch was applied from static source code analysis. Markus Elfring (3): Delete an unnecessary check before the function call "kfree" One function call less in scsiback_device

[PATCH] SCSI-lpfc: Use a signed return type for two functions

2015-12-19 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 19 Dec 2015 19:32:27 +0100 The return type "size_t" was used by the functions "lpfc_wwn_set" and "lpfc_oas_lun_state_set" despite of the aspect that they will eventually return a negative error code. Improve this implementation detail by using the type "ssize_t" in

Re: [PATCH 1/7] iscsi-target: Use a variable initialisation in iscsi_set_default_param() directly

2015-12-14 Thread SF Markus Elfring
> @@ -127,9 +127,8 @@ static struct iscsi_param *iscsi_set_default_param(struct > iscsi_param_list *para > char *name, char *value, u8 phase, u8 scope, u8 sender, > u16 type_range, u8 use) > { > - struct iscsi_param *param = NULL; > + struct iscsi_param *param;

Re: [PATCH 1/7] iscsi-target: Use a variable initialisation in iscsi_set_default_param() directly

2015-12-12 Thread SF Markus Elfring
>> @@ -127,9 +127,8 @@ static struct iscsi_param >> *iscsi_set_default_param(struct iscsi_param_list *para >> char *name, char *value, u8 phase, u8 scope, u8 sender, >> u16 type_range, u8 use) >> { >> -struct iscsi_param *param = NULL; >> +struct iscsi_param *par

Re: [PATCH 4/7] iscsi-target: Make a variable initialisation a bit more obvious in iscsi_create_default_params()

2015-12-12 Thread SF Markus Elfring
>> @@ -200,9 +200,8 @@ free_param: >> int iscsi_create_default_params(struct iscsi_param_list **param_list_ptr) >> { >> struct iscsi_param *param; >> -struct iscsi_param_list *pl; >> +struct iscsi_param_list *pl = kzalloc(sizeof(*pl), GFP_KERNEL); >> >> -pl = kzalloc(sizeof(struc

[PATCH 7/7] iscsi-target: Make two variable initialisations a bit more obvious in iscsi_check_valuelist_for_support()

2015-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 12 Dec 2015 15:04:57 +0100 The variable "acceptor_values" and "proposer_values" were initialized by null pointers and immediately assigned values from input parameters by separate statements. Let us express the desired variable initialisations directly. Signed-off

[PATCH 6/7] iscsi-target: Delete unnecessary variable initialisations in iscsi_check_valuelist_for_support()

2015-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 12 Dec 2015 14:34:26 +0100 The variables "tmp1" and "tmp2" will eventually be set to appropriate pointers from a call of the strchr() function. Thus let us omit the explicit initialisation at the beginning. Signed-off-by: Markus Elfring --- drivers/target/iscsi/

[PATCH 5/7] iscsi-target: Rename a jump label in iscsi_create_default_params()

2015-12-12 Thread SF Markus Elfring
From: Markus Elfring Date: Sat, 12 Dec 2015 14:12:50 +0100 This issue was detected by using the Coccinelle software. Choose a jump label according to the current Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/target/iscsi/iscsi_target_parameters.c | 64 +-

  1   2   >