On Saturday 25 July 2009 15:15:24 Eduardo Valentin wrote: > On Sat, Jul 25, 2009 at 03:20:53PM +0200, ext Hans Verkuil wrote: > > > + switch (control->id) { > > > + case V4L2_CID_RDS_TX_PS_NAME: > > > + if (strlen(sdev->rds_info.ps_name) + 1 > control->length) { > > > + control->length = strlen(sdev->rds_info.ps_name) + 1; > > > > I recommend setting length to the actual maximum MAX_RDS_PS_NAME+1. > > > > > + rval = -ENOSPC; > > > + goto exit; > > > + } > > > + rval = copy_to_user(control->string, sdev->rds_info.ps_name, > > > + strlen(sdev->rds_info.ps_name) + 1); > > > + break; > > > + > > > + case V4L2_CID_RDS_TX_RADIO_TEXT: > > > + if (strlen(sdev->rds_info.radio_text) + 1 > control->length) { > > > + control->length = strlen(sdev->rds_info.radio_text) + 1; > > > > Ditto. > > Right, I think doing the way you are proposing is to avoid changes that may generate > failures in the following reads. > > I 'll change this in the v11 as well. OK. > > > +struct rds_info { > > > + u32 pi; > > > +#define MAX_RDS_PTY 31 > > > + u32 pty; > > > +#define MAX_RDS_DEVIATION 90000 > > > + u32 deviation; > > > +#define MAX_RDS_PS_NAME 96 > > > + u8 ps_name[MAX_RDS_PS_NAME + 1]; > > > +#define MAX_RDS_RADIO_TEXT 384 > > > > I'm surprised at these MAX string lengths. Looking at the RDS standard it > > seems that the max length for the PS_NAME is 8 and for RADIO_TEXT it is > > either 32 (2A group) or 64 (2B group). I don't know which group the si4713 > > uses. > > > > Can you clarify how this is used? Did you see this comment as well? I'm quite interested in this. Hans -- Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html