Re: [PATCH 4/4] bad-shift: wait dead code elimination to warn about bad shifts

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

 



On Sat, Aug 15, 2020 at 01:15:40PM +0200, Luc Van Oostenryck wrote:
> On Sat, Aug 15, 2020 at 06:57:03PM +0900, Stafford Horne wrote:
> > On Thu, Aug 06, 2020 at 09:30:03PM +0200, Luc Van Oostenryck wrote:
> > > --- a/linearize.c
> > > +++ b/linearize.c
> > > @@ -2468,6 +2468,49 @@ static pseudo_t linearize_statement(struct entrypoint *ep, struct statement *stm
> > >  	return VOID;
> > >  }
> > >  
> > > +static void check_tainted_insn(struct instruction *insn)
> > > +{
> > > +	unsigned long long uval;
> > > +	long long sval;
> > > +	pseudo_t src2;
> > > +
> > > +	switch (insn->opcode) {
> > > +	case OP_DIVU: case OP_DIVS:
> > > +	case OP_MODU: case OP_MODS:
> > > +		if (insn->src2 == value_pseudo(0))
> > > +			warning(insn->pos, "divide by zero");
> > > +		break;
> > 
> > Is this divide by zero a new check?  I get the shift, but is this new?
> 
> Yes, and no. The warning is already given (using 'division by zero')
> but, like for shifts before this series, issued early, before dead code
> elimination is done. So, code like the following:
> 	...
> 	if (d != 0)
> 		r = a / d;
> 	...
> issues the warning nevertheless. So, the check here above is now unused
> but is a preparation for the part 2 doing the same for division by zero
> by zero.

I see, it's preparation for part 2, makes sense.

-Stafford



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux