Skip to content

Commit

Permalink
[PARISC] fix uninitialized variable warning in asm/rtc.h
Browse files Browse the repository at this point in the history
get_rtc_time, in the case that PDC returns that the battery is bad, returns
an unmodified rtc_time arg to the caller, which then uses uninitialized
values. Fix this by memset-ing the arg with zeroes, so it will at least be
cleared if we return failure.

Spotted by John David Anglin.

Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
  • Loading branch information
Kyle McMartin committed Oct 20, 2007
1 parent 562d139 commit 7210c67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/asm-parisc/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ static inline unsigned int get_rtc_time(struct rtc_time *wtime)
long int days, rem, y;
const unsigned short int *ip;

if(pdc_tod_read(&tod_data) < 0)
memset(wtime, 0, sizeof(*wtime));
if (pdc_tod_read(&tod_data) < 0)
return RTC_24H | RTC_BATT_BAD;


// most of the remainder of this function is:
// Copyright (C) 1991, 1993, 1997, 1998 Free Software Foundation, Inc.
// This was originally a part of the GNU C Library.
Expand Down

0 comments on commit 7210c67

Please sign in to comment.