Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1619505
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/3] iscsi-target: Improve size determinations in four functions |
| Date | Sun, 09 Apr 2017 16:30:01 +0200 |
| Message-ID | <tum0N-3WS-1@gated-at.bofh.it> (permalink) |
| References | <tum0N-3WS-3@gated-at.bofh.it> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Language | en-GB |
| Content-Transfer-Encoding | 7bit |
| X-Provags-ID | V03:K0:34JYLzMAzs8DYpSHFmFXiX/DoZibLgadaEfFIk2ut2mS1LFkKO+ a8xMRNVypB+wxoI2tVusL+cArJkqHq3MO3FnmyUoH+8b1xnz5v+UjTQ+X+wDiwSdQvew9LJ rLuJID63+OyakAB5zpC7qDUQJnW3lfDhM1Hs49cAamRj7cpbv12umm31FZoA5lTpB7cmBp9 Bt0aw89BVJRiPW12ZFsdw== |
| X-Ui-Out-Filterresults | notjunk:1;V01:K0:Gn3nCwSAVp4=:zoxIFr5E5yUCqpDXyXvZaZ G1uwlMmAzBI0V7+UL6bbtWkK5548uu9IDhgkywWU/ewLWO25xMw5+QwNkhaxFFULc6XI5yJ6s CVMUtfUYT5NL7XWhWCO5ZnhHVyyQ906bos0jYKy+h5wcI7TobOdbQR6mFhQucFyj+tTLEIiUM EO16NKfXtI92WRR9sEzqh/oVueqUmj9q9GM1+XK/xIdC/QksF9dWS8yAd7SThC5V3vFCVEm1/ knMcvVskZHuFTtDpK04sBEL2hp5MPP6y1IMEjM6Hn1ibUfvul71Gf76JfsFY7rKkoCYIJwbrE C0rz/coHp8uYh0KAIznyDI9sm4x7d7Vfmn3/RZH1rC9OLMa+mdibKV93sWj7w60ADtvCTdmK6 WNvskAYdKw3Bo/edWBPKrems1qWhL7d7Hfqvgb1EimZgjtd1GdfHfUF3WBRTS3l7iCuEePww/ dWPw9QWp2KHtp81okkJU66vULP0rgwX3lhkW7fIMYP8pFawjewG+JXlmEOzoeVRg6W826uo2p ukxcJUjkY2zMUYgmFeS660fZDTbFuzNmYaw2KdxjqrY/nVtAS1J6Bec05s7Huk7qtHp9HcTx1 SES1ZleSKhPHR2wBA3tEGWPsj9i5INYzVK5m87yJaD5DK6NL9gRqgaj3Mb5fzluTuYIVr81pU nmMAkyu+9mwcOwRo2xPMVWkBh3xfoI5zXCxUQXLCuPAt+uNQhkV6WucSOuuqlXBQIhptihPy/ xdfj4oybn+gU05ZBt2a4dSWwXeBmXL0QrqMkCXeoT0mjDowcy0JwyQqHTiRLv4E+4zWe84mWL 32P+LDV |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 56 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | LKML <linux-kernel@vger.kernel.org>, kernel-janitors@vger.kernel.org |
| X-Original-Date | Sun, 9 Apr 2017 16:28:42 +0200 |
| X-Original-Message-ID | <b2f306db-d191-67bb-1e9b-0e91cd540481@users.sourceforge.net> |
| X-Original-References | <f573fbbe-aef2-7b68-1540-ceb2f30a6aa6@users.sourceforge.net> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1619505 |
Show key headers only | View raw
From: Markus Elfring <elfring@users.sourceforge.net>
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: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/target/iscsi/iscsi_target.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 196e9dd138ca..5ef6eb238174 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -128,7 +128,7 @@ struct iscsi_tiqn *iscsit_add_tiqn(unsigned char *buf)
return ERR_PTR(-EINVAL);
}
- tiqn = kzalloc(sizeof(struct iscsi_tiqn), GFP_KERNEL);
+ tiqn = kzalloc(sizeof(*tiqn), GFP_KERNEL);
if (!tiqn)
return ERR_PTR(-ENOMEM);
@@ -360,7 +360,7 @@ struct iscsi_np *iscsit_add_np(
return np;
}
- np = kzalloc(sizeof(struct iscsi_np), GFP_KERNEL);
+ np = kzalloc(sizeof(*np), GFP_KERNEL);
if (!np) {
mutex_unlock(&np_lock);
return ERR_PTR(-ENOMEM);
@@ -694,8 +694,7 @@ static int __init iscsi_target_init_module(void)
int ret = 0, size;
pr_debug("iSCSI-Target "ISCSIT_VERSION"\n");
-
- iscsit_global = kzalloc(sizeof(struct iscsit_global), GFP_KERNEL);
+ iscsit_global = kzalloc(sizeof(*iscsit_global), GFP_KERNEL);
if (!iscsit_global)
return -1;
@@ -1987,8 +1986,7 @@ iscsit_handle_task_mgt_cmd(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
hdr->refcmdsn = cpu_to_be32(ISCSI_RESERVED_TAG);
cmd->data_direction = DMA_NONE;
-
- cmd->tmr_req = kzalloc(sizeof(struct iscsi_tmr_req), GFP_KERNEL);
+ cmd->tmr_req = kzalloc(sizeof(*cmd->tmr_req), GFP_KERNEL);
if (!cmd->tmr_req)
return iscsit_add_reject_cmd(cmd,
ISCSI_REASON_BOOKMARK_NO_RESOURCES,
--
2.12.2
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 3/3] iscsi-target: Improve size determinations in four functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-04-09 16:30 +0200
csiph-web