From: Egor Uleyskiy <egor.ulieiskii@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Egor Uleyskiy <egor.ulieiskii@gmail.com>,
Manohar Vanga <manohar.vanga@gmail.com>,
Martyn Welch <martyn@welchs.me.uk>,
Trivial Patch Monkey <trivial@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] drivers: staging: vme: Fixed the using of sizeof
Date: Sun, 22 Nov 2015 11:27:54 +0200 [thread overview]
Message-ID: <1448184477-24767-3-git-send-email-egor.ulieiskii@gmail.com> (raw)
In-Reply-To: <1448184477-24767-1-git-send-email-egor.ulieiskii@gmail.com>
From: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Constructions that looks like
card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
are changed to
card = kzalloc(sizeof(*card), GFP_KERNEL);
Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
---
drivers/staging/vme/devices/vme_pio2_core.c | 2 +-
drivers/staging/vme/devices/vme_user.c | 10 +++++-----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/vme/devices/vme_pio2_core.c b/drivers/staging/vme/devices/vme_pio2_core.c
index f3b878b..a30282a 100644
--- a/drivers/staging/vme/devices/vme_pio2_core.c
+++ b/drivers/staging/vme/devices/vme_pio2_core.c
@@ -215,7 +215,7 @@ static int pio2_probe(struct vme_dev *vdev)
u8 reg;
int vec;
- card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
+ card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card) {
retval = -ENOMEM;
goto err_struct;
diff --git a/drivers/staging/vme/devices/vme_user.c b/drivers/staging/vme/devices/vme_user.c
index 8e61a3b..a05a065 100644
--- a/drivers/staging/vme/devices/vme_user.c
+++ b/drivers/staging/vme/devices/vme_user.c
@@ -308,7 +308,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
switch (cmd) {
case VME_IRQ_GEN:
copied = copy_from_user(&irq_req, argp,
- sizeof(struct vme_irq_id));
+ sizeof(irq_req));
if (copied != 0) {
pr_warn("Partial copy from userspace\n");
return -EFAULT;
@@ -322,7 +322,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
case MASTER_MINOR:
switch (cmd) {
case VME_GET_MASTER:
- memset(&master, 0, sizeof(struct vme_master));
+ memset(&master, 0, sizeof(master));
/* XXX We do not want to push aspace, cycle and width
* to userspace as they are
@@ -334,7 +334,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
&master.cycle, &master.dwidth);
copied = copy_to_user(argp, &master,
- sizeof(struct vme_master));
+ sizeof(master));
if (copied != 0) {
pr_warn("Partial copy to userspace\n");
return -EFAULT;
@@ -368,7 +368,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
case SLAVE_MINOR:
switch (cmd) {
case VME_GET_SLAVE:
- memset(&slave, 0, sizeof(struct vme_slave));
+ memset(&slave, 0, sizeof(slave));
/* XXX We do not want to push aspace, cycle and width
* to userspace as they are
@@ -379,7 +379,7 @@ static int vme_user_ioctl(struct inode *inode, struct file *file,
&slave.aspace, &slave.cycle);
copied = copy_to_user(argp, &slave,
- sizeof(struct vme_slave));
+ sizeof(slave));
if (copied != 0) {
pr_warn("Partial copy to userspace\n");
return -EFAULT;
--
2.5.0
next prev parent reply other threads:[~2015-11-22 9:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-22 9:27 [PATCH 1/6] drivers: staging: vme: Fixed indention Egor Uleyskiy
2015-11-22 9:27 ` [PATCH 2/6] drivers: staging: vme: Deleted extra empty lines Egor Uleyskiy
2015-11-22 9:27 ` Egor Uleyskiy [this message]
2015-11-22 9:27 ` [PATCH 4/6] drivers: staging: vme: Deleted extra bracking Egor Uleyskiy
2015-11-22 9:27 ` [PATCH 5/6] drivers: staging: vme: Fixed checking NULL and 0 code style Egor Uleyskiy
2015-11-22 9:27 ` [PATCH 6/6] drivers: staging: vme: Deleted casting to (void *) Egor Uleyskiy
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=1448184477-24767-3-git-send-email-egor.ulieiskii@gmail.com \
--to=egor.ulieiskii@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manohar.vanga@gmail.com \
--cc=martyn@welchs.me.uk \
--cc=trivial@kernel.org \
/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
all inboxes | Powered by JetHome®