Re: [PATCH v3 1/2] core: Add Manufacturer Specific Data EIR field

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

 



Hi Marcel,

On Mon, Oct 13, 2014, Marcel Holtmann wrote:
> Hi Johan,
> 
> >> +		case EIR_MANUFACTURER_DATA:
> >> +			if (data_len < 2 || data_len > 2 + sizeof(eir->msd->data))
> >> +				break;
> >> +			eir->msd = g_malloc(sizeof(*eir->msd));
> >> +			eir->msd->company = get_le16(data);
> >> +			eir->msd->data_len = data_len - 2;
> >> +			memcpy(&eir->msd->data, data + 2, eir->msd->data_len);
> >> +			break;
> > 
> > Wouldn't this lead to a memory leaks if a device (violating the spec. but
> > still) had two or more manufacturer data entries in it's AD/EIR data?
> > Taking example from how remote name entries are handled you should
> > probably g_free(eir->msd) before allocating a new one.
> 
> have multiple manufacturer data entries is not violating the
> specification. That is actually valid.

Right you are. I was somehow assuming this would be similar to e.g. the
UUID fields. Anyway, if we want to represent in the new internal API all
that is allowed in the spec it'd need some redesign. OTOH, I'm not sure
it's worth it until we have an example of an actual product that has
multiple entries).

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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux