From: SF Markus Elfring <elfring@users.sourceforge.net>
To: kernel-janitors@vger.kernel.org,
Al Viro <viro@zeniv.linux.org.uk>,
Alexey Dobriyan <adobriyan@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Dan Carpenter <dan.carpenter@oracle.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Ingo Molnar <mingo@kernel.org>,
Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2/7] VMCI: Improve a size determination in two functions
Date: Wed, 10 Jan 2018 20:25:53 +0100 [thread overview]
Message-ID: <05412529-d0e2-0894-6229-431caa48c498@users.sourceforge.net> (raw)
In-Reply-To: <2747f123-a95d-bc68-b858-0327dce3758b@users.sourceforge.net>
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Wed, 10 Jan 2018 17:47:40 +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 detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
drivers/misc/vmw_vmci/vmci_context.c | 2 +-
drivers/misc/vmw_vmci/vmci_host.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/vmw_vmci/vmci_context.c b/drivers/misc/vmw_vmci/vmci_context.c
index c0ea68255340..c7085ff76327 100644
--- a/drivers/misc/vmw_vmci/vmci_context.c
+++ b/drivers/misc/vmw_vmci/vmci_context.c
@@ -618,7 +618,7 @@ int vmci_ctx_add_notification(u32 context_id, u32 remote_cid)
goto out;
}
- notifier = kmalloc(sizeof(struct vmci_handle_list), GFP_KERNEL);
+ notifier = kmalloc(sizeof(*notifier), GFP_KERNEL);
if (!notifier) {
result = VMCI_ERROR_NO_MEM;
goto out;
diff --git a/drivers/misc/vmw_vmci/vmci_host.c b/drivers/misc/vmw_vmci/vmci_host.c
index 4246a033de18..14da8210fd34 100644
--- a/drivers/misc/vmw_vmci/vmci_host.c
+++ b/drivers/misc/vmw_vmci/vmci_host.c
@@ -124,7 +124,7 @@ static int vmci_host_open(struct inode *inode, struct file *filp)
{
struct vmci_host_dev *vmci_host_dev;
- vmci_host_dev = kzalloc(sizeof(struct vmci_host_dev), GFP_KERNEL);
+ vmci_host_dev = kzalloc(sizeof(*vmci_host_dev), GFP_KERNEL);
if (vmci_host_dev == NULL)
return -ENOMEM;
--
2.15.1
next prev parent reply other threads:[~2018-01-10 19:26 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-10 19:23 [PATCH 0/7] VMCI: Adjustments for several function implementations SF Markus Elfring
2018-01-10 19:24 ` [PATCH 1/7] VMCI: Delete error messages for a failed memory allocation in seven functions SF Markus Elfring
2018-01-10 19:25 ` SF Markus Elfring [this message]
2018-01-10 19:27 ` [PATCH 3/7] VMCI: Update a word in five comment lines SF Markus Elfring
2018-01-10 19:28 ` [PATCH 4/7] VMCI: Delete an unnecessary null pointer check in qp_broker_create() SF Markus Elfring
2018-01-10 19:29 ` [PATCH 5/7] VMCI: Delete an unnecessary variable initialisation " SF Markus Elfring
2018-01-10 19:30 ` [PATCH 6/7] VMCI: Less function calls in qp_broker_create() after error detection SF Markus Elfring
2018-01-10 19:32 ` [PATCH 7/7] VMCI: Adjust 32 checks for null pointers SF Markus Elfring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=05412529-d0e2-0894-6229-431caa48c498@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=adobriyan@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=dan.carpenter@oracle.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavo@embeddedor.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yamada.masahiro@socionext.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome