+ rtc-class-error-checks.patch added to -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     RTC class: error checks

has been added to the -mm tree.  Its filename is

     rtc-class-error-checks.patch

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: RTC class: error checks
From: David Brownell <david-b@xxxxxxxxxxx>

The rtc_is_valid_tm() routine needs to treat some of the fields it checks as
unsigned, to prevent wrongly accepting invalid rtc_time structs; this is the
same approach used elsewhere in the RTC code for such tests.

Conversely, rtc_proc_show() is missing one invalid-day-of-month test that
rtc_is_valid_tm() makes: there is no day zero.

Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/rtc/rtc-lib.c  |    8 ++++----
 drivers/rtc/rtc-proc.c |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff -puN drivers/rtc/rtc-lib.c~rtc-class-error-checks drivers/rtc/rtc-lib.c
--- a/drivers/rtc/rtc-lib.c~rtc-class-error-checks
+++ a/drivers/rtc/rtc-lib.c
@@ -94,12 +94,12 @@ EXPORT_SYMBOL(rtc_time_to_tm);
 int rtc_valid_tm(struct rtc_time *tm)
 {
 	if (tm->tm_year < 70
-		|| tm->tm_mon >= 12
+		|| ((unsigned)tm->tm_mon) >= 12
 		|| tm->tm_mday < 1
 		|| tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900)
-		|| tm->tm_hour >= 24
-		|| tm->tm_min >= 60
-		|| tm->tm_sec >= 60)
+		|| ((unsigned)tm->tm_hour) >= 24
+		|| ((unsigned)tm->tm_min) >= 60
+		|| ((unsigned)tm->tm_sec) >= 60)
 		return -EINVAL;
 
 	return 0;
diff -puN drivers/rtc/rtc-proc.c~rtc-class-error-checks drivers/rtc/rtc-proc.c
--- a/drivers/rtc/rtc-proc.c~rtc-class-error-checks
+++ a/drivers/rtc/rtc-proc.c
@@ -61,7 +61,7 @@ static int rtc_proc_show(struct seq_file
 			seq_printf(seq, "%02d-", alrm.time.tm_mon + 1);
 		else
 			seq_printf(seq, "**-");
-		if ((unsigned int)alrm.time.tm_mday <= 31)
+		if (alrm.time.tm_mday && (unsigned int)alrm.time.tm_mday <= 31)
 			seq_printf(seq, "%02d\n", alrm.time.tm_mday);
 		else
 			seq_printf(seq, "**\n");
_

Patches currently in -mm which might be from david-b@xxxxxxxxxxx are

origin.patch
i2c-tps65010-update-for-current-i2c-omap.patch
git-pcmcia.patch
rtc-class-kconfig-improvements.patch
rtc-class-uses-subsys_init.patch
rtc-class-error-checks.patch
constify-rtc_class_ops-update-drivers.patch
at91rm9200-rtc-can-issue-system-wakeup-events.patch
omap_cf-works-again-sync-with-linux-omap-tree.patch
ide-reprogram-disk-pio-timings-on-resume.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux