linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH 4/5] libblkid: fix sizeof(foo) vs sizeof(*foo) malloc() bug
Date: Fri,  3 Jan 2014 00:29:57 -0500	[thread overview]
Message-ID: <1388726998-14349-4-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <1388726998-14349-1-git-send-email-tytso@mit.edu>

Addresses-Coverity-Bug: #709510

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/blkid/probe.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index bd31fe0..6f74bd4 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -1003,7 +1003,7 @@ static int probe_udf(struct blkid_probe *probe,
 	   (block sizes larger than 2K will be null padded) */
 	for (bs = 1; bs < 16; bs++) {
 		isosb = (struct iso_volume_descriptor *)
-			get_buffer(probe, bs*2048+32768, sizeof(isosb));
+			get_buffer(probe, bs*2048+32768, sizeof(*isosb));
 		if (!isosb)
 			return 1;
 		if (isosb->vd_id[0])
@@ -1015,7 +1015,7 @@ static int probe_udf(struct blkid_probe *probe,
 		if (j > 1) {
 			isosb = (struct iso_volume_descriptor *)
 				get_buffer(probe, j*bs*2048+32768,
-					   sizeof(isosb));
+					   sizeof(*isosb));
 			if (!isosb)
 				return 1;
 		}
@@ -1223,7 +1223,7 @@ static int probe_hfsplus(struct blkid_probe *probe,
 		off = (alloc_first_block * 512) +
 			(embed_first_block * alloc_block_size);
 		buf = get_buffer(probe, off + (id->bim_kboff * 1024),
-				 sizeof(sbd));
+				 sizeof(*sbd));
 		if (!buf)
 			return 1;
 
-- 
1.8.5.rc3.362.gdf10213


  parent reply	other threads:[~2014-01-03  5:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-03  5:29 [PATCH 1/5] e2image: fix resource leak when running e2image -n Theodore Ts'o
2014-01-03  5:29 ` [PATCH 2/5] e2image: eliminate division by zero Theodore Ts'o
2014-01-03 16:40   ` Eric Sandeen
2014-01-03  5:29 ` [PATCH 3/5] e2image: avoid potential divide " Theodore Ts'o
2014-01-03 16:42   ` Eric Sandeen
2014-01-03  5:29 ` Theodore Ts'o [this message]
2014-01-03 16:44   ` [PATCH 4/5] libblkid: fix sizeof(foo) vs sizeof(*foo) malloc() bug Eric Sandeen
2014-01-03  5:29 ` [PATCH 5/5] subst: clean up various coverity nits Theodore Ts'o
2014-01-03 16:32 ` [PATCH 1/5] e2image: fix resource leak when running e2image -n Eric Sandeen

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=1388726998-14349-4-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=linux-ext4@vger.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;
as well as URLs for NNTP newsgroup(s).