public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] exofs: add a cap on the memcpy() size
@ 2012-01-30  7:59 Dan Carpenter
  2012-01-30 13:37 ` Boaz Harrosh
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Dan Carpenter @ 2012-01-30  7:59 UTC (permalink / raw)
  To: kernel-janitors

This data comes from the device, so probably it's fairly trustworthy but
it makes the static checkers happy if we check it.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/fs/exofs/super.c b/fs/exofs/super.c
index d22cd16..755812a 100644
--- a/fs/exofs/super.c
+++ b/fs/exofs/super.c
@@ -529,6 +529,8 @@ static int exofs_devs_2_odi(struct exofs_dt_device_info *dt_dev,
 			     struct osd_dev_info *odi)
 {
 	odi->systemid_len = le32_to_cpu(dt_dev->systemid_len);
+	if (odi->systemid_len > OSD_SYSTEMID_LEN)
+		return -EINVAL;
 	memcpy(odi->systemid, dt_dev->systemid, odi->systemid_len);
 
 	odi->osdname_len = le32_to_cpu(dt_dev->osdname_len);

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-01-30 16:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-30  7:59 [patch] exofs: add a cap on the memcpy() size Dan Carpenter
2012-01-30 13:37 ` Boaz Harrosh
2012-01-30 13:44 ` Dan Carpenter
2012-01-30 13:50 ` Boaz Harrosh
2012-01-30 14:01 ` Dan Carpenter
2012-01-30 16:20 ` Boaz Harrosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox