MIPS: irixelf: fix test unsigned var < 0
Subsystems (5)
PATCH 1/6 MIPS: irixelf: fix test unsigned var < 0
v is unsigned, cast to signed to evaluate the do_brk() return value,
---
arch/mips/kernel/irixelf.c +1 -1
@@ -583,15 +583,15 @@ static void irix_map_prda_page(void)unsigned long v;struct prda *pp;down_write (¤t->mm->mmap_sem); v =do_brk (PRDA_ADDRESS ,PAGE_SIZE );up_write (¤t->mm->mmap_sem); -if (v <0 ) +if ((long ) v <0 )return ; pp = (struct prda *) v; pp->prda_sys.t_pid =task_pid_vnr (current); pp->prda_sys.t_prid =read_c0_prid (); pp->prda_sys.t_rpid =task_pid_vnr (current);
New_alarm is unsigned so the test didn't work.
---
drivers/rtc/rtc-ds1374.c +3 -3
@@ -216,16 +216,16 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)rtc_tm_to_time (&alarm->time, &new_alarm);rtc_tm_to_time (&now, &itime); - new_alarm -= itime; -/* This can happen due to races, in addition to dates that are * truly in the past. To avoid requiring the caller to check for * races, dates in the past are assumed to be in the recent past * (i.e. not something that we'd rather the caller know about via * an error), and the alarm is set to go off as soon as possible. */ -if (new_alarm <=0 ) +if (new_alarm <= itime) new_alarm =1 ; +else + new_alarm -= itime;mutex_lock (&ds1374->mutex);
PATCH 4/6 RTC: rtc-ds1374: fix unsigned new_alarm test
Sorry for the duplicate, I forgot to fix the email header
---New_alarm is unsigned so the test didn't work.
---
drivers/rtc/rtc-ds1374.c +3 -3
@@ -216,16 +216,16 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)rtc_tm_to_time (&alarm->time, &new_alarm);rtc_tm_to_time (&now, &itime); - new_alarm -= itime; -/* This can happen due to races, in addition to dates that are * truly in the past. To avoid requiring the caller to check for * races, dates in the past are assumed to be in the recent past * (i.e. not something that we'd rather the caller know about via * an error), and the alarm is set to go off as soon as possible. */ -if (new_alarm <=0 ) +if (new_alarm <= itime) new_alarm =1 ; +else + new_alarm -= itime;mutex_lock (&ds1374->mutex);
PATCH 5/6 NETFILTER: signed tcphoff for ipv6_skip_exthdr() retval
In reply to Roel Kluinif tcphoff remains unsigned, a negative ipv6_skip_exthdr() return value will go unnoticed,
---
net/netfilter/xt_TCPOPTSTRIP.c +1 -1
@@ -90,7 +90,7 @@ tcpoptstrip_tg6(struct sk_buff *skb, const struct net_device *in, const struct xt_target *target, const void *targinfo) { struct ipv6hdr *ipv6h = ipv6_hdr(skb); -unsigned int tcphoff; +int tcphoff;u_int8_t nexthdr; nexthdr = ipv6h->nexthdr;
PATCH 6/6 sound/drivers/dummy.c: fix negative snd_pcm_format_width() check
In reply to Roel Kluinbps is unsigned, a negative snd_pcm_format_width() return value is not noticed
---
sound/drivers/dummy.c +5 -4
@@ -230,13 +230,14 @@ static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;struct snd_dummy_pcm *dpcm = runtime->private_data; -unsigned int bps; +int bps; + + bps =snd_pcm_format_width (runtime->format) * runtime->rate * + runtime->channels /8 ; - bps = runtime->rate * runtime->channels; - bps *=snd_pcm_format_width (runtime->format); - bps /=8 ;if (bps <=0 )return -EINVAL ; + dpcm->pcm_bps = bps; dpcm->pcm_jiffie = bps /HZ ; dpcm->pcm_size =snd_pcm_lib_buffer_bytes (substream);
Takashi Iwai
AppliedRe: [alsa-devel] [PATCH 6/6] sound/drivers/dummy.c: fix negative snd_pcm_format_width() check
At Wed, 16 Apr 2008 18:20:33 +0200,
Quoted 4 lines · Roel Kluin
bps is unsigned, a negative
snd_pcm_format_width()return value is not noticedSigned-off-by Roel Kluin <[email protected]>
Applied to ALSA tree. Thanks.
Takashi
Quoted 29 lines
---
sound/drivers/dummy.c +5
-4@@ -230,13 +230,14 @@ static int snd_card_dummy_pcm_prepare(struct snd_pcm_substream *substream) {struct snd_pcm_runtime *runtime = substream->runtime;struct snd_dummy_pcm *dpcm = runtime->private_data; -unsigned int bps; +int bps; + + bps =snd_pcm_format_width (runtime->format) * runtime->rate * + runtime->channels /8 ; - bps = runtime->rate * runtime->channels; - bps *=snd_pcm_format_width (runtime->format); - bps /=8 ;if (bps <=0 )return -EINVAL ; + dpcm->pcm_bps = bps; dpcm->pcm_jiffie = bps /HZ ; dpcm->pcm_size =snd_pcm_lib_buffer_bytes (substream);_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Quoted 1 line · Roel Kluin
v is unsigned, cast to signed to evaluate the
do_brk()return value,
do_brk() is expected to return its first argument as the result in case of success. An error also wasn't getting propagated so some further fixes were needed for irix_map_prda_page and its caller. So I'll apply a different fix.
Thanks!
Ralf
Quoted 9 lines · Roel Kluin
v is unsigned, cast to signed to evaluate the
do_brk()return value,Signed-off-by Roel Kluin <[email protected]>---
arch/mips/kernel/irixelf.c +0
-0
arch/mips/kernel/irixelf.c static void irix_map_prda_page(void) · line 590
Quoted 9 lines
arch/mips/kernel/irixelf.c +1
-1@@ -583,15 +583,15 @@ static void irix_map_prda_page(void)unsigned long v;struct prda *pp;down_write (¤t->mm->mmap_sem); v =do_brk (PRDA_ADDRESS ,PAGE_SIZE );up_write (¤t->mm->mmap_sem); -if (v <0 ) +if ((long ) v <0 )
maybe cast it earlier (to struct prda *) and check error with IS_ERR?
Quoted 13 lines
arch/mips/kernel/irixelf.c +0
-1return ; pp = (struct prda *) v; pp->prda_sys.t_pid =task_pid_vnr (current); pp->prda_sys.t_prid =read_c0_prid (); pp->prda_sys.t_rpid =task_pid_vnr (current); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] RTC: rtc-ds1374: fix unsigned new_alarm test
In reply to Roel KluinQuoted 3 lines · On Wed, 16 Apr 2008 17:32:28 +0200 Roel Kluin <[email protected]> wrote:
New_alarmis unsigned so the test didn't work.Signed-off-by Roel Kluin <[email protected]>
Signature · 6 lines
Best regards, Alessandro Zummo, Tower Technologies - Torino, Italy http://www.towertech.it
Patrick McHardy
AppliedRe: [netfilter-core] [PATCH 5/6] NETFILTER: signed tcphoff for ipv6_skip_exthdr() retval
In reply to Roel KluinQuoted 2 lines · Roel Kluin
if tcphoff remains unsigned, a negative
ipv6_skip_exthdr()return value will go unnoticed,
Applied, thanks.